fromJson method
Implementation
@override
OutlinedBorder? fromJson(Map<String, dynamic>? json) {
if (json == null) return null;
String? type = json['type'];
switch (type) {
case 'beveled':
return BeveledRectangleBorder(
borderRadius: const NullableBorderRadiusConverter().fromJson(
json['borderRadius'],
) ??
BorderRadius.zero,
side: const NullableBorderSideConverter().fromJson(
json['side'],
) ??
BorderSide.none,
);
case 'circle':
return CircleBorder(
side: const NullableBorderSideConverter().fromJson(
json['side'],
) ??
BorderSide.none,
);
case 'rectangle':
return ContinuousRectangleBorder(
borderRadius: const NullableBorderRadiusConverter().fromJson(
json['borderRadius'],
) ??
BorderRadius.zero,
side: const NullableBorderSideConverter().fromJson(
json['side'],
) ??
BorderSide.none,
);
case 'rounded':
return RoundedRectangleBorder(
borderRadius: const NullableBorderRadiusConverter().fromJson(
json['borderRadius'],
) ??
BorderRadius.zero,
side: const NullableBorderSideConverter().fromJson(
json['side'],
) ??
BorderSide.none,
);
case 'stadium':
return StadiumBorder(
side: const NullableBorderSideConverter().fromJson(
json['side'],
) ??
BorderSide.none,
);
}
throw 'Unsuported_Json_Value';
}