enum_string_value_generator 0.0.1+1 copy "enum_string_value_generator: ^0.0.1+1" to clipboard
enum_string_value_generator: ^0.0.1+1 copied to clipboard

outdated

Now your enum classes have String values!!

Generator of enum_string_value.

Usage #

(See whole example project)

Put build.yaml on the root of your project.

targets:
  $default:
    builders:
      enum_string_value_generator|enumHasValueBuilder:
        generate_for:
          - lib/*.dart
copied to clipboard

Add packages to your pubspec.yaml.

dependencies:
  enum_string_value_lib: ^0.0.1

dev_dependencies:
  build_runner: ^1.7.2
  enum_string_value_generator: ^0.0.1
copied to clipboard

Add @Value annotation to your enum values and part directive for the generated file.

// os.dart
import 'package:enum_string_value_lib/enum_string_value_lib.dart';
part "os.value.g.dart";

enum OsKind {
  @Value("Android")
  android,
  @Value("iOS")
  ios,
}
copied to clipboard

Run build_runner on your project.

$ pub run build_runner build
copied to clipboard
0
likes
0
points
16
downloads

Publisher

unverified uploader

Weekly Downloads

2024.09.17 - 2025.04.01

Now your enum classes have String values!!

Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

analyzer, build, code_builder, enum_string_value_lib, source_gen

More

Packages that depend on enum_string_value_generator