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': ThemeEncoder.encodeAlignment(alignment),
'boundaryMargin':
EdgeInsets.zero == boundaryMargin
? null
: ThemeEncoder.encodeEdgeInsets(boundaryMargin),
'clipBehavior':
Clip.hardEdge == clipBehavior
? null
: ThemeEncoder.encodeClip(clipBehavior),
'constrained': true == constrained ? null : constrained,
'interactionEndFrictionCoefficient':
0.0000135 == interactionEndFrictionCoefficient
? null
: interactionEndFrictionCoefficient,
'maxScale': 2.5 == maxScale ? null : maxScale,
'minScale': 0.8 == minScale ? null : minScale,
'onInteractionEnd': onInteractionEnd,
'onInteractionStart': onInteractionStart,
'onInteractionUpdate': onInteractionUpdate,
'panAxis':
PanAxis.free == panAxis ? null : ThemeEncoder.encodePanAxis(panAxis),
'panEnabled': true == panEnabled ? null : panEnabled,
'scaleEnabled': true == scaleEnabled ? null : scaleEnabled,
'scaleFactor':
kDefaultMouseScrollToScaleFactor == scaleFactor ? null : scaleFactor,
'trackpadScrollCausesScale':
false == trackpadScrollCausesScale ? null : trackpadScrollCausesScale,
'transformationController': transformationController,
'child': child.toJson(),
...args,
});
}