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({
'animateColor': true == animateColor ? null : animateColor,
'animateShadowColor':
true == animateShadowColor ? null : animateShadowColor,
'borderRadius': BorderRadius.zero == borderRadius
? null
: ThemeEncoder.encodeBorderRadius(
borderRadius,
),
'clipBehavior': Clip.none == clipBehavior
? null
: ThemeEncoder.encodeClip(
clipBehavior,
),
'color': ThemeEncoder.encodeColor(
color,
),
'curve': Curves.linear == curve ? null : CurvesValues.encode(curve),
'duration': duration.inMilliseconds,
'elevation': elevation,
'onEnd': onEnd,
'shadowColor': ThemeEncoder.encodeColor(
shadowColor,
),
'shape': ThemeEncoder.encodeBoxShape(
shape,
),
'child': child.toJson(),
...args,
});
}