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({
'alignment': Alignment.center == alignment
? null
: ThemeEncoder.encodeAlignmentGeometry(
alignment,
),
'clipBehavior': Clip.none == clipBehavior
? null
: ThemeEncoder.encodeClip(
clipBehavior,
),
'fit': BoxFit.contain == fit
? null
: ThemeEncoder.encodeBoxFit(
fit,
),
'child': child?.toJson(),
...args,
});
}