Git Product home page Git Product logo

enume's Issues

"is not a enum" error when Enum is not in his own file

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.

g.dart files do not get generated

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.

String to enum

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.