All Downloads are FREE. Search and download functionalities are using the official Maven repository.

dart-dio.enum.mustache Maven / Gradle / Ivy

import 'package:built_collection/built_collection.dart';
import 'package:built_value/built_value.dart';
import 'package:built_value/serializer.dart';

part '{{classFilename}}.g.dart';

class {{classname}} extends EnumClass {

  {{#allowableValues}}
    {{#enumVars}}
      {{#description}}
  /// {{description}}
      {{/description}}
  @BuiltValueEnumConst(wireName: {{{value}}})
  static const {{classname}} {{name}} = _${{name}};
    {{/enumVars}}
  {{/allowableValues}}

  static Serializer<{{classname}}> get serializer => _${{classVarName}}Serializer;

  const {{classname}}._(String name): super(name);

  static BuiltSet<{{classname}}> get values => _$values;
  static {{classname}} valueOf(String name) => _$valueOf(name);
}

/// Optionally, enum_class can generate a mixin to go with your enum for use
/// with Angular. It exposes your enum constants as getters. So, if you mix it
/// in to your Dart component class, the values become available to the
/// corresponding Angular template.
///
/// Trigger mixin generation by writing a line like this one next to your enum.
abstract class {{classname}}Mixin = Object with _${{classname}}Mixin;




© 2015 - 2024 Weber Informatics LLC | Privacy Policy