Skip to content

Instantly share code, notes, and snippets.

@RedBrogdon
Last active December 5, 2020 20:06
Show Gist options
  • Save RedBrogdon/6472e714b96788fc75db50aab7682d2a to your computer and use it in GitHub Desktop.
Save RedBrogdon/6472e714b96788fc75db50aab7682d2a to your computer and use it in GitHub Desktop.
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