Created
October 1, 2020 13:58
-
-
Save Grohden/3a6a28dedda20872ce97819b9c86c065 to your computer and use it in GitHub Desktop.
Snipped for is null problem
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
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