Enum.fromJson constructor

Enum.fromJson(
  1. Object? j
)

Implementation

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