Skip to content

Instantly share code, notes, and snippets.

@rrousselGit
Created November 12, 2019 18:49
Show Gist options
  • Save rrousselGit/8632a6137be256cd909e5ee8b403c5f5 to your computer and use it in GitHub Desktop.
Save rrousselGit/8632a6137be256cd909e5ee8b403c5f5 to your computer and use it in GitHub Desktop.
void main() {
A a = B();
if (a.property is int) {
print(a.property.runtimeType); // double
}
}
class A {
A(this.property);
final num property;
}
class B implements A {
int callCount = 0;
num get property {
callCount++;
if (callCount.isOdd) {
return 42;
} else {
return 42.5;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment