Answers for "how to generate enums in built value"

0

how to generate enums in built value

class VehicleType extends EnumClass {
// these are the fields it will be according to your need

  static const VehicleType car = _$car;
  static const VehicleType train = _$train;
  static const VehicleType bmw = _$BMW;
  static const VehicleType tesla = _$Tesla;
  static const VehicleType price = _$10000;

// below functions will always be constant

  const VehicleType._(String name) : super(name);

  static BuiltSet<VehicleType> get values => _$values;
  static VehicleType valueOf(String name) => _$valueOf(name);
}
Posted by: Guest on October-12-2021

Browse Popular Code Answers by Language