toJson method

  1. @override
Map<String, dynamic> toJson()
override
  • to json
  • 转 json

Implementation

@override
Map<String, dynamic> toJson() {
  return <String, dynamic>{
    if (data != null) 'data': data,
    if (style != null) 'style': style?.toJson(),
    if (strutStyle != null) 'strutStyle': strutStyle?.toJson(),
    if (textAlign != null) 'textAlign': textAlign?.toString(),
    if (textDirection != null) 'textDirection': textDirection?.toString(),
    if (locale != null) 'locale': locale?.toJson(),
    if (softWrap != null) 'softWrap': softWrap,
    if (overflow != null) 'overflow': overflow?.toString(),
    if (textScaleFactor != null) 'textScaleFactor': textScaleFactor,
    if (maxLines != null) 'maxLines': maxLines,
    if (semanticsLabel != null) 'semanticsLabel': semanticsLabel,
    if (textWidthBasis != null) 'textWidthBasis': textWidthBasis?.toString(),
    if (textHeightBehavior != null)
      'textHeightBehavior': textHeightBehavior?.toJson(),
    if (selectionColor != null) 'selectionColor': selectionColor?.value,
  };
}