Created
December 18, 2019 19:39
-
-
Save ailabs-software/dc3bfd3e1568d5ebb36df205676bdbe4 to your computer and use it in GitHub Desktop.
Extension method on dynamic
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 on dynamic { | |
bool get stringNotEmpty => this is String && this.isNotEmpty; | |
} | |
void main() | |
{ | |
Object foo = new Object(); | |
print( foo.stringNotEmpty ); | |
print( "".stringNotEmpty ); | |
print( "Lorde is awesome".stringNotEmpty ); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment