Field.fromJson constructor
Field.fromJson(
- Object? j
Implementation
factory Field.fromJson(Object? j) {
final json = j as Map<String, Object?>;
return Field(
kind: switch (json['kind']) {
null => Field_Kind.$default,
Object $1 => Field_Kind.fromJson($1),
},
cardinality: switch (json['cardinality']) {
null => Field_Cardinality.$default,
Object $1 => Field_Cardinality.fromJson($1),
},
number: switch (json['number']) {
null => 0,
Object $1 => decodeInt($1),
},
name: switch (json['name']) {
null => '',
Object $1 => decodeString($1),
},
typeUrl: switch (json['typeUrl']) {
null => '',
Object $1 => decodeString($1),
},
oneofIndex: switch (json['oneofIndex']) {
null => 0,
Object $1 => decodeInt($1),
},
packed: switch (json['packed']) {
null => false,
Object $1 => decodeBool($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'),
},
jsonName: switch (json['jsonName']) {
null => '',
Object $1 => decodeString($1),
},
defaultValue: switch (json['defaultValue']) {
null => '',
Object $1 => decodeString($1),
},
);
}