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({
'clipBehavior': Clip.hardEdge == clipBehavior
? null
: ThemeEncoder.encodeClip(
clipBehavior,
),
'controller': controller,
'dragStartBehavior': DragStartBehavior.start == dragStartBehavior
? null
: ThemeEncoder.encodeDragStartBehavior(
dragStartBehavior,
),
'keyboardDismissBehavior':
ScrollViewKeyboardDismissBehavior.manual == keyboardDismissBehavior
? null
: ThemeEncoder.encodeScrollViewKeyboardDismissBehavior(
keyboardDismissBehavior,
),
'padding': ThemeEncoder.encodeEdgeInsetsGeometry(
padding,
),
'physics': ThemeEncoder.encodeScrollPhysics(
physics,
),
'primary': primary,
'restorationId': restorationId,
'reverse': false == reverse ? null : reverse,
'scrollDirection': Axis.vertical == scrollDirection
? null
: ThemeEncoder.encodeAxis(
scrollDirection,
),
'child': child?.toJson(),
...args,
});
}