encodeInputBorder static method
Encodes the given value
to a JSON representation. This only supports
the following subclasses:
OutlineInputBorder
UnderlineInputBorder
The returned structure depends on the subclass.
OutlineInputBorder
{
borderRadius: <BorderRadius>,
borderSide: <BorderSide>,
gapPadding: <double>
}
UnderlineInputborder
{
borderRadius: <BorderRadius>,
borderSide: <BorderSide>
}
See also:
Implementation
static Map<String, dynamic>? encodeInputBorder(InputBorder? value) {
assert(value == null ||
value is OutlineInputBorder ||
value is UnderlineInputBorder);
Map<String, dynamic>? result;
if (value != null) {
if (value is OutlineInputBorder) {
result = {
'borderRadius': encodeBorderRadius(value.borderRadius),
'borderSide': encodeBorderSide(value.borderSide),
'gapPadding': value.gapPadding,
'type': 'outline',
};
} else if (value is UnderlineInputBorder) {
result = {
'borderRadius': encodeBorderRadius(value.borderRadius),
'borderSide': encodeBorderSide(value.borderSide),
'type': 'underline',
};
}
}
return _stripNull(result);
}