Skip to content

Instantly share code, notes, and snippets.

@dolpheen
Created January 18, 2020 21:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dolpheen/de8dbf032b1a9dfce330c5e469ef7d93 to your computer and use it in GitHub Desktop.
Save dolpheen/de8dbf032b1a9dfce330c5e469ef7d93 to your computer and use it in GitHub Desktop.
Dart Internals - Getters Setters VM Example
class A {
String prop;
}
class B {
String _prop;
String get prop => _prop;
set prop(String value)=>_prop = value;
}
class C {
String get prop => 'Prop from C!';
}
void main(){
var a = A();
a.prop = 'propA';
print(a.prop);
var b = B();
b.prop = 'propB';
print(b.prop);
var c = C();
print(c.prop);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment