toJson static method

Map<String, dynamic>? toJson(
  1. TextStyle? textStyle
)

Converts TextStyle to JSON map

Implementation

static Map<String, dynamic>? toJson(TextStyle? textStyle) {
  if (textStyle == null) return null;
  return {
    'color': textStyle.color?.value,
    'fontSize': textStyle.fontSize,
    'fontWeight': textStyle.fontWeight?.index,
    'letterSpacing': textStyle.letterSpacing,
    'wordSpacing': textStyle.wordSpacing,
  };
}