Created
November 12, 2019 18:49
-
-
Save rrousselGit/8632a6137be256cd909e5ee8b403c5f5 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
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