Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enum is not a class element #469

Open
kevin-ye opened this issue May 28, 2024 · 1 comment
Open

Enum is not a class element #469

kevin-ye opened this issue May 28, 2024 · 1 comment

Comments

@kevin-ye
Copy link

I am using a dart native Enum as return type in module, the generator is throwing error saying my enum "is not a class element"

pubspec.yaml:

dependencies:
  flutter:
    sdk: flutter
  flutter_localizations:
    sdk: flutter
  flutter_mobx: ^2.2.1+1
  get_it: ^7.7.0
  injectable: ^2.4.2
  mobx: ^2.3.3+2
  mobx_codegen: ^2.6.1
  package_info_plus: ^8.0.0
  provider: ^6.1.2

dev_dependencies:
  flutter_test:
    sdk: flutter

  flutter_lints: ^3.0.0
  injectable_generator: ^2.6.1
  build_runner: ^2.4.10

Module:

Enum PlatformType { android, ios }

@module
abstract class AppModule {
  @Named("currentPlatform")
  PlatformType get currentPlatform {
    if (Platform.isAndroid) {
      return PlatformType.android;
    } else {
      return PlatformType.ios;
    }
  }
}
@ChaserVasya
Copy link

same

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants