enum_ext 1.4.0 enum_ext: ^1.4.0 copied to clipboard
Lets make enums super useful by adding some useful extension methods. Say good bye to switch-case and if-else blocks.
1.4.0 #
- Breaking -
value
getter is replaced withextValue
- Features Added -
- Now the eunm property can be accessed with
byExtValue()
likebyName()
from values.
- Now the eunm property can be accessed with
1.3.2 #
Removed unused dependency recase
.
1.3.1 #
Breaking - Now title
getter will be generated, you do not need to import package:enum_ext/enum_ext.dart
package anymore in order to use this. Instead import the file containing enum.
1.3.0 #
Breaking - Removed all cases (snackCase, camelCase, dotCase, headerCase
etc.) in order to make enum more robust and clean
Now it generate title
getter extension in order to get title case of enum property name
@EnumExt()
enum HttpResponse {
ok,
notFound,
internalServerError,
}
void main() {
print(HttpResponse.ok.title); // Ok
print(HttpResponse.notFound.title); // Not Found
print(HttpResponse.internalServerError.title); // Internal Server Error
}
1.2.0 #
- Generating value checking getters like
is...
andisNot...
Example
@EnumExt()
enum Gender { male, female, other }
// This will generate isMale, isNotMale, isFemale, isNotFemale,
// isOther, isNotOther getters
void main() {
final gender = Gender.male;
// Now you can use
gender.isMale; // Instead of gender == Gender.male
gender.isFemale; // Instead of gender == Gender.female
}
1.0.0 #
- Initial version.