Sequence.fromJson constructor

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

Converts a JSON object to a Sequence instance.

Implementation

factory Sequence.fromJson(Map<String, dynamic> json) {
  return Sequence(
    json['sequence'] as String,
    style: json['style'] != null
        ? TextStyle(
            fontFamily: json['style']['font_family'] ?? '',
            fontSize: json['style']['font_size'],
            fontWeight: json['style']['font_weight'] != null
                ? FontWeight.values[json['style']['font_weight']]
                : null,
            fontStyle: json['style']['font_style'] != null
                ? FontStyle.values[json['style']['font_style']]
                : null,
            color: json['style']['color'] != null
                ? Color(json['style']['color'])
                : null,
            backgroundColor: json['style']['background_color'] != null
                ? Color(json['style']['background_color'])
                : null,
            decoration: _stringToTextDecoration(json['style']['decoration']),
            decorationColor: json['style']['decoration_color'] != null
                ? Color(json['style']['decoration_color'])
                : null,
            decorationStyle: json['style']['decoration_style'] != null
                ? TextDecorationStyle
                    .values[json['style']['decoration_style']]
                : null,
            letterSpacing: json['style']['letter_spacing'],
            wordSpacing: json['style']['word_spacing'],
            height: json['style']['height'],
            locale: json['style']['locale'] != null
                ? Locale(json['style']['locale'])
                : null,
          )
        : null,
  );
}