Created
March 10, 2021 22:04
-
-
Save r100-stack/fa9daf2f1660bf5f40207b291182098c to your computer and use it in GitHub Desktop.
Sample code to have Dart object print its fields
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class A { | |
int? i1; | |
int? i2; | |
A({this.i1, this.i2}); | |
} | |
class B { | |
int? i1; | |
int? i2; | |
B({this.i1, this.i2}); | |
toString() { | |
return 'i1: $i1, i2: $i2'; | |
} | |
} | |
void main() { | |
A a = A(i1: 10, i2: 20); | |
B b = B(i1: 10, i2: 20); | |
print(a); | |
print(b); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment