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() {
return JsonClass.removeNull({
'borderOnForeground':
true == borderOnForeground ? null : borderOnForeground,
'clipBehavior': ThemeEncoder.encodeClip(
clipBehavior,
),
'color': ThemeEncoder.encodeColor(
color,
),
'elevation': elevation,
'margin': ThemeEncoder.encodeEdgeInsetsGeometry(
margin,
),
'semanticContainer': true == semanticContainer ? null : semanticContainer,
'shadowColor': ThemeEncoder.encodeColor(
shadowColor,
),
'shape': ThemeEncoder.encodeShapeBorder(
shape,
),
'surfaceTintColor': ThemeEncoder.encodeColor(
surfaceTintColor,
),
'child': child?.toJson(),
...args,
});
}