Api.fromJson constructor
Api.fromJson(
- Object? j
Implementation
factory Api.fromJson(Object? j) {
final json = j as Map<String, Object?>;
return Api(
name: switch (json['name']) {
null => '',
Object $1 => decodeString($1),
},
methods: switch (json['methods']) {
null => [],
List<Object?> $1 => [for (final i in $1) Method.fromJson(i)],
_ => throw const FormatException('"methods" 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'),
},
version: switch (json['version']) {
null => '',
Object $1 => decodeString($1),
},
sourceContext: switch (json['sourceContext']) {
null => null,
Object $1 => SourceContext.fromJson($1),
},
mixins: switch (json['mixins']) {
null => [],
List<Object?> $1 => [for (final i in $1) Mixin.fromJson(i)],
_ => throw const FormatException('"mixins" is not a list'),
},
syntax: switch (json['syntax']) {
null => Syntax.$default,
Object $1 => Syntax.fromJson($1),
},
edition: switch (json['edition']) {
null => '',
Object $1 => decodeString($1),
},
);
}