Last active
December 5, 2020 20:06
-
-
Save RedBrogdon/6472e714b96788fc75db50aab7682d2a to your computer and use it in GitHub Desktop.
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 MyClass { | |
int? anInt; | |
} | |
class MyOtherClass extends MyClass { | |
int count = 0; | |
int? get anInt { | |
count++; | |
return count % 2 == 1 ? 1 : null; | |
} | |
} | |
void main() { | |
final a = MyOtherClass(); | |
if (a.anInt != null) { | |
print(a.anInt); | |
} | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment