FlutterOutlineAttribute.fromJson constructor
FlutterOutlineAttribute.fromJson(
- JsonDecoder jsonDecoder,
- String jsonPath,
- Object? json
)
Implementation
factory FlutterOutlineAttribute.fromJson(
JsonDecoder jsonDecoder, String jsonPath, Object? json) {
json ??= {};
if (json is Map) {
String name;
if (json.containsKey('name')) {
name = jsonDecoder.decodeString('$jsonPath.name', json['name']);
} else {
throw jsonDecoder.mismatch(jsonPath, 'name');
}
String label;
if (json.containsKey('label')) {
label = jsonDecoder.decodeString('$jsonPath.label', json['label']);
} else {
throw jsonDecoder.mismatch(jsonPath, 'label');
}
bool? literalValueBoolean;
if (json.containsKey('literalValueBoolean')) {
literalValueBoolean = jsonDecoder.decodeBool(
'$jsonPath.literalValueBoolean', json['literalValueBoolean']);
}
int? literalValueInteger;
if (json.containsKey('literalValueInteger')) {
literalValueInteger = jsonDecoder.decodeInt(
'$jsonPath.literalValueInteger', json['literalValueInteger']);
}
String? literalValueString;
if (json.containsKey('literalValueString')) {
literalValueString = jsonDecoder.decodeString(
'$jsonPath.literalValueString', json['literalValueString']);
}
Location? nameLocation;
if (json.containsKey('nameLocation')) {
nameLocation = Location.fromJson(
jsonDecoder, '$jsonPath.nameLocation', json['nameLocation']);
}
Location? valueLocation;
if (json.containsKey('valueLocation')) {
valueLocation = Location.fromJson(
jsonDecoder, '$jsonPath.valueLocation', json['valueLocation']);
}
return FlutterOutlineAttribute(name, label,
literalValueBoolean: literalValueBoolean,
literalValueInteger: literalValueInteger,
literalValueString: literalValueString,
nameLocation: nameLocation,
valueLocation: valueLocation);
} else {
throw jsonDecoder.mismatch(jsonPath, 'FlutterOutlineAttribute', json);
}
}