fromJson static method

TextStyle? fromJson(
  1. Map<String, dynamic>? json
)

Converts JSON map to TextStyle

Implementation

static TextStyle? fromJson(Map<String, dynamic>? json) {
  if (json == null) return null;
  return TextStyle(
    color: json['color'] != null ? Color(json['color']) : null,
    fontSize: (json['fontSize'] as num?)?.toDouble(),
    fontWeight: (json.containsKey('fontWeight') && json['fontWeight'] != null)
        ? FontWeight.values[json['fontWeight']]
        : null,
    letterSpacing: (json['letterSpacing'] as num?)?.toDouble(),
    wordSpacing: (json['wordSpacing'] as num?)?.toDouble(),
  );
}