I have started learning Dart and Flutter and wanted to understand one concept:
Updated code: try in dartpad
class Service{
String ask = '';
void write (String receivedData){
ask = receivedData;
}
}
class WriteNow{
String hi = 'hi';
Service art = Service();
void okay () {
art.write(hi);
}
}
void main () {
WriteNow a = WriteNow();
a.okay();
Service b = Service();
print(b.ask);
}
I run WriteToService first and then ReadFromService, I cannot get the 'Hello', but get the original string ''. Please clarify. Also, how does this scale?