fromJson method
Implementation
@override
TextStyle? fromJson(Map<String, dynamic>? json) {
if (json == null) return null;
return TextStyle(
// @unencodable
// background
backgroundColor: const NullableColorConverter().fromJson(
json['backgroundColor'],
),
color: const NullableColorConverter().fromJson(
json['color'],
),
decoration: const NullableTextDecorationConverter().fromJson(
json['decoration'],
),
decorationColor: const NullableColorConverter().fromJson(
json['decorationColor'],
),
decorationStyle: const NullableTextDecorationStyleConverter().fromJson(
json['decorationStyle'],
),
decorationThickness: (json['decorationThickness'] as num?)?.toDouble(),
fontFamily: json['fontFamily'],
fontFamilyFallback: json['fontFamilyFallback'] == null
? null
: List<String>.from(json['fontFamilyFallback']),
fontFeatures: json['fontFeatures'] == null
? null
: List<FontFeature>.from(
json['fontFeatures'].map(
(json) => const NullableFontFeatureConverter().fromJson(
json,
),
),
),
fontWeight: const NullableFontWeightConverter().fromJson(
json['fontWeight'],
),
fontSize: (json['fontSize'] as num?)?.toDouble(),
fontStyle: const NullableFontStyleConverter().fromJson(
json['fontStyle'],
),
// @unencodable
// foreground
height: (json['height'] as num?)?.toDouble(),
inherit: json['inherit'] == null ? true : (json['inherit'] as bool),
letterSpacing: (json['letterSpacing'] as num?)?.toDouble(),
locale: const NullableLocaleConverter().fromJson(
json['locale'],
),
package: json['package'],
shadows: json['shadows'] == null
? null
: List<Shadow>.from(
json['shadows'].map(
(json) => const NullableShadowConverter().fromJson(json),
),
),
textBaseline: const NullableTextBaselineConverter().fromJson(
json['textBaseline'],
),
wordSpacing: (json['wordSpacing'] as num?)?.toDouble(),
);
}