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({
'curve': Curves.linear == curve ? null : CurvesValues.encode(curve),
'duration': duration.inMilliseconds,
'maxLines': maxLines,
'onEnd': onEnd,
'overflow': TextOverflow.clip == overflow
? null
: ThemeEncoder.encodeTextOverflow(
overflow,
),
'softWrap': true == softWrap ? null : softWrap,
'style': ThemeEncoder.encodeTextStyle(
style,
),
'textAlign': ThemeEncoder.encodeTextAlign(
textAlign,
),
'textHeightBehavior': ThemeEncoder.encodeTextHeightBehavior(
textHeightBehavior,
),
'textWidthBasis': TextWidthBasis.parent == textWidthBasis
? null
: ThemeEncoder.encodeTextWidthBasis(
textWidthBasis,
),
'child': child.toJson(),
...args,
});
}