toJson method
Implementation
@override
Map<String, dynamic>? toJson(ShapeBorder? object) {
if (object == null) return null;
if (object is CircleBorder) {
return <String, dynamic>{
'side': const NullableBorderSideConverter().toJson(object.side),
'type': 'circle',
};
} else if (object is ContinuousRectangleBorder) {
return <String, dynamic>{
'borderRadius': const NullableBorderRadiusConverter()
.toJson(object.borderRadius as BorderRadius?),
'side': const NullableBorderSideConverter().toJson(object.side),
'type': 'rectangle',
};
} else if (object is RoundedRectangleBorder) {
return <String, dynamic>{
'borderRadius': const NullableBorderRadiusConverter()
.toJson(object.borderRadius as BorderRadius?),
'side': const NullableBorderSideConverter().toJson(object.side),
'type': 'rounded',
};
} else if (object is StadiumBorder) {
return <String, dynamic>{
'side': const NullableBorderSideConverter().toJson(object.side),
'type': 'stadium',
};
}
throw 'Json_Unsuported_Value';
}