Skip to content

Instantly share code, notes, and snippets.

@pgainullin
Created December 1, 2020 08:17
Show Gist options
  • Save pgainullin/0ce9d7652217b36416484526fe532192 to your computer and use it in GitHub Desktop.
Save pgainullin/0ce9d7652217b36416484526fe532192 to your computer and use it in GitHub Desktop.
Dart assignment for different types
void main() {
int a = 5;
print(a);
int b = a;
print(b);
a = 23;
print(b);
String aString = '5';
print(aString);
String bString = aString;
print(bString);
aString = '23';
print(bString);
ComplexObject aComplex = ComplexObject(5);
print(aComplex.data);
ComplexObject bComplex = aComplex;
print(bComplex.data);
aComplex.data = 23;
print(bComplex.data);
}
class ComplexObject {
int data;
ComplexObject(this.data);
}
@pgainullin
Copy link
Author

Console
5
5
5
5
5
5
5
5
23

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment