Skip to content

Instantly share code, notes, and snippets.

@Grohden
Created October 2, 2020 17:21
Show Gist options
  • Save Grohden/f848d908d387ed1597677d2768ae5932 to your computer and use it in GitHub Desktop.
Save Grohden/f848d908d387ed1597677d2768ae5932 to your computer and use it in GitHub Desktop.
Snippet showing method extension on dynamic with error
class Foo {
dynamic getA(){
return null;
}
}
extension IsNull on dynamic {
bool get isNull => this == null;
}
void main() {
var foo = Foo();
print(foo.getA().isNull);
foo = null;
foo.isNull;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment