Created
February 6, 2025 14:09
-
-
Save vital-edu/0958c4b5b2c8cef309488d11067539b2 to your computer and use it in GitHub Desktop.
Extension Type
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
void main() { | |
final BoolInt n = BoolInt(0); | |
myPrint(n); | |
} | |
extension type BoolInt(int value) implements int { | |
bool get isFalsy => this == 0; | |
} | |
void myPrint(dynamic value) { | |
print (value.isFalsy ? 'false' : 'true'); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment