Skip to content

Instantly share code, notes, and snippets.

@Grohden
Created October 1, 2020 13:58
Show Gist options
  • Save Grohden/3a6a28dedda20872ce97819b9c86c065 to your computer and use it in GitHub Desktop.
Save Grohden/3a6a28dedda20872ce97819b9c86c065 to your computer and use it in GitHub Desktop.
Snipped for is null problem
extension Nulls on dynamic {
bool get isNull => this == null;
}
class Foo {
String getA(){
return null;
}
}
void main() {
var foo = Foo();
var bar = "";
print(foo.getA().isNull);
print(bar.isNull);
bar = null;
print(bar.isNull);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment