Skip to content

Instantly share code, notes, and snippets.

@vital-edu
Created February 6, 2025 14:09
Show Gist options
  • Save vital-edu/0958c4b5b2c8cef309488d11067539b2 to your computer and use it in GitHub Desktop.
Save vital-edu/0958c4b5b2c8cef309488d11067539b2 to your computer and use it in GitHub Desktop.
Extension Type
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