fromJson method
Implementation
@override
InputBorder? fromJson(Map<String, dynamic>? json) {
if (json == null) return null;
String? type = json['type'];
switch (type) {
case 'outline':
return OutlineInputBorder(
borderRadius: const NullableBorderRadiusConverter().fromJson(
json['borderRadius'],
) ??
const BorderRadius.all(Radius.circular(4.0)),
borderSide: const NullableBorderSideConverter().fromJson(
json['borderSide'],
) ??
const BorderSide(),
gapPadding: ((json['gapPadding'] ?? 4.0) as num).toDouble(),
);
case 'underline':
return UnderlineInputBorder(
borderRadius: const NullableBorderRadiusConverter().fromJson(
json['borderRadius'],
) ??
const BorderRadius.only(
topLeft: Radius.circular(4.0),
topRight: Radius.circular(4.0),
),
borderSide: const NullableBorderSideConverter().fromJson(
json['borderSide'],
) ??
const BorderSide(),
);
}
throw 'Unsuported_Json_Value';
}