EnumValue.fromJson constructor

EnumValue.fromJson(
  1. Object? j
)

Implementation

factory EnumValue.fromJson(Object? j) {
  final json = j as Map<String, Object?>;
  return EnumValue(
    name: switch (json['name']) {
      null => '',
      Object $1 => decodeString($1),
    },
    number: switch (json['number']) {
      null => 0,
      Object $1 => decodeInt($1),
    },
    options: switch (json['options']) {
      null => [],
      List<Object?> $1 => [for (final i in $1) Option.fromJson(i)],
      _ => throw const FormatException('"options" is not a list'),
    },
  );
}