toJson method

  1. @override
Object? toJson(
  1. FontStyleTokenValue value
)

Implementation

@override
Object? toJson(FontStyleTokenValue value) {
  return {
    if (value.textStyle.fontSize != null)
      'fontSize': value.textStyle.fontSize,
    if (value.textStyle.fontFamily != null)
      'fontFamily': value.textStyle.fontFamily,
    if (value.textStyle.letterSpacing != null)
      'letterSpacing': value.textStyle.letterSpacing,
    if (value.textStyle.fontWeight != null)
      'fontWeight': (value.textStyle.fontWeight!.index + 1) * 100,
    if (value.textStyle.decoration != null)
      'decoration': () {
        if (value.textStyle.decoration == TextDecoration.lineThrough) {
          return 'line-through';
        }
        if (value.textStyle.decoration == TextDecoration.underline) {
          return 'underline';
        }
        return null;
      }(),
    if (value.textStyle.fontStyle != null)
      'fontStyle': () {
        if (value.textStyle.fontStyle == FontStyle.italic) {
          return 'italic';
        }
        return null;
      }(),
  };
}