toJson method
Abstract function that concrete classes must implement. This must encode the internal data model to a JSON compatible representation.
While not required, it is suggested to call removeNull before returning.
Implementation
@override
Map<String, dynamic> toJson() => {
'alignment': ThemeEncoder.encodeAlignment(alignment),
'autofocus': autofocus,
'autovalidateMode':
ThemeEncoder.encodeAutovalidateMode(autovalidateMode),
'borderRadius': ThemeEncoder.encodeBorderRadius(borderRadius),
'decoration': decoration,
'disabledHint': disabledHint,
'dropdownColor': ThemeEncoder.encodeColor(dropdownColor),
'elevation': elevation,
'enableFeedback': enableFeedback,
'enabled': enabled,
'hint': hint?.toJson(),
'icon': icon?.toJson(),
'items': JsonClass.toJsonList(items),
'iconDisabledColor': ThemeEncoder.encodeColor(iconDisabledColor),
'iconEnabledColor': ThemeEncoder.encodeColor(iconEnabledColor),
'iconSize': iconSize,
'isDense': isDense,
'isExpanded': isExpanded,
'itemHeight': itemHeight,
'menuMaxHeight': menuMaxHeight,
'onChanged': onChanged,
'onSaved': onSaved,
'onTap': onTap,
'selectedItemBuilder': selectedItemBuilder,
'style': ThemeEncoder.encodeTextStyle(style),
'validator': validator == null
? null
: {
'validators': validator!.toJson(),
},
'value': value,
...args,
};