toJson method

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

Implementation

@override
Map<String, dynamic>? toJson(TextStyle? value) {
  if (value == null) return null;

  return <String, dynamic>{
    'backgroundColor':
        const NullableColorConverter().toJson(value.backgroundColor),
    'color': const NullableColorConverter().toJson(value.color),
    'decoration':
        const NullableTextDecorationConverter().toJson(value.decoration),
    'decorationColor':
        const NullableColorConverter().toJson(value.decorationColor),
    'decorationStyle': const NullableTextDecorationStyleConverter()
        .toJson(value.decorationStyle),
    'decorationThickness': value.decorationThickness,
    'fontFamily': value.fontFamily,
    'fontFamilyFallback': value.fontFamilyFallback,
    'fontFeatures': value.fontFeatures == null
        ? null
        : value.fontFeatures!
            .map(
              (value) => const NullableFontFeatureConverter().toJson(value),
            )
            .toList(),
    'fontWeight':
        const NullableFontWeightConverter().toJson(value.fontWeight),
    'fontSize': value.fontSize,
    'fontStyle': const NullableFontStyleConverter().toJson(value.fontStyle),
    'height': value.height,
    'inherit': value.inherit,
    'letterSpacing': value.letterSpacing,
    'locale': const NullableLocaleConverter().toJson(value.locale),
    'shadows': value.shadows == null
        ? null
        : value.shadows!
            .map(
              (value) => const NullableShadowConverter().toJson(value),
            )
            .toList(),
    'textBaseline':
        const NullableTextBaselineConverter().toJson(value.textBaseline),
    'wordSpacing': value.wordSpacing,
  };

  throw 'Json_Unsuported_Value';
}