toJson method

  1. @override
Map<String, dynamic> toJson()
override

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({
    'data': data,
    'locale': ThemeEncoder.encodeLocale(
      locale,
    ),
    'maxLines': maxLines,
    'overflow': ThemeEncoder.encodeTextOverflow(
      overflow,
    ),
    'selectionColor': ThemeEncoder.encodeColor(
      selectionColor,
    ),
    'semanticsLabel': semanticsLabel,
    'softWrap': softWrap,
    'strutStyle': ThemeEncoder.encodeStrutStyle(
      strutStyle,
    ),
    'style': ThemeEncoder.encodeTextStyle(
      style,
    ),
    'textAlign': ThemeEncoder.encodeTextAlign(
      textAlign,
    ),
    'textDirection': ThemeEncoder.encodeTextDirection(
      textDirection,
    ),
    'textHeightBehavior': ThemeEncoder.encodeTextHeightBehavior(
      textHeightBehavior,
    ),
    'textScaleFactor': textScaleFactor,
    'textScaler': textScaler,
    'textWidthBasis': ThemeEncoder.encodeTextWidthBasis(
      textWidthBasis,
    ),
    ...args,
  });
}