ladegeraet / enume Goto Github PK
View Code? Open in Web Editor NEWUseful enum extensions
License: BSD 3-Clause "New" or "Revised" License
Useful enum extensions
License: BSD 3-Clause "New" or "Revised" License
class FirstClass {
// ...
}
@Enume()
enum FirstClassEnum { foo, bar }
This will result in an error
'FirstClassEnum is not a enum and cannot be annotated with @\Enume()'
I guess the Problem is this check here
!EnumValidator.isEnum(element.enclosingElement)
As a workaround i put the enum in it's own dart file, but would be nice if i can put it together with the other class.
The TypedEnum and name functions should be summarized and replaced by an @enum annoation.
Nice package for storing strings in enum, but lacks translation of strings to enum. For example, if the data comes from the server.
Solutions:
// GENERATED CODE - DO NOT MODIFY BY HAND
part of 'authentication_failure_code.dart';
// **************************************************************************
// TypedEnumGenerator
// **************************************************************************
extension Values on AuthenticationFailureCode {
String get value {
switch (this) {
case AuthenticationFailureCode.invalidCredentials:
return 'Authentication:InvalidCredentials';
}
}
}
extension StringToValue on String {
AuthenticationFailureCode get value {
switch (this) {
case 'Authentication:InvalidCredentials':
return AuthenticationFailureCode.invalidCredentials;
}
}
}
or
AuthenticationFailureCode.values.firstWhere((element) => element.value == authenticationResult.code)
When using the example project and running the run build_runner command the project create the .g.dart
files.
But after coping the same file to my project and adding both enume
and enume_generator
running flutter pub get and all the files aren't get created.
Can't see any unregular errors, just part ... file does not exit.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.