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({
'anchor': 0.0 == anchor ? null : anchor,
'cacheExtent': cacheExtent,
'center': center,
'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,
),
'physics': ThemeEncoder.encodeScrollPhysics(
physics,
),
'primary': primary,
'restorationId': restorationId,
'reverse': false == reverse ? null : reverse,
'scrollBehavior': ThemeEncoder.encodeScrollBehavior(
scrollBehavior,
),
'scrollDirection': Axis.vertical == scrollDirection
? null
: ThemeEncoder.encodeAxis(
scrollDirection,
),
'semanticChildCount': semanticChildCount,
'shrinkWrap': false == shrinkWrap ? null : shrinkWrap,
'slivers': const <JsonWidgetData>[] == slivers
? null
: JsonClass.toJsonList(slivers),
...args,
});
}