Model.fromJson constructor
Model.fromJson(
- Object? j
Implementation
factory Model.fromJson(Object? j) {
final json = j as Map<String, Object?>;
return Model(
name: switch (json['name']) {
null => '',
Object $1 => decodeString($1),
},
baseModelId: switch (json['baseModelId']) {
null => '',
Object $1 => decodeString($1),
},
version: switch (json['version']) {
null => '',
Object $1 => decodeString($1),
},
displayName: switch (json['displayName']) {
null => '',
Object $1 => decodeString($1),
},
description: switch (json['description']) {
null => '',
Object $1 => decodeString($1),
},
inputTokenLimit: switch (json['inputTokenLimit']) {
null => 0,
Object $1 => decodeInt($1),
},
outputTokenLimit: switch (json['outputTokenLimit']) {
null => 0,
Object $1 => decodeInt($1),
},
supportedGenerationMethods: switch (json['supportedGenerationMethods']) {
null => [],
List<Object?> $1 => [for (final i in $1) decodeString(i)],
_ => throw const FormatException(
'"supportedGenerationMethods" is not a list',
),
},
temperature: switch (json['temperature']) {
null => null,
Object $1 => decodeDouble($1),
},
maxTemperature: switch (json['maxTemperature']) {
null => null,
Object $1 => decodeDouble($1),
},
topP: switch (json['topP']) {
null => null,
Object $1 => decodeDouble($1),
},
topK: switch (json['topK']) {
null => null,
Object $1 => decodeInt($1),
},
thinking: switch (json['thinking']) {
null => false,
Object $1 => decodeBool($1),
},
);
}