fromJson method

  1. @override
StrutStyle? fromJson(
  1. Map<String, dynamic>? json
)
override

Implementation

@override
StrutStyle? fromJson(Map<String, dynamic>? json) {
  if (json == null) return null;

  return StrutStyle(
    fontFamily: json['fontFamily'],
    fontFamilyFallback: _decodeStringList(
      json['fontFamilyFallback'],
      (json) => json,
    ),
    fontSize: (json['fontSize'] as num?)?.toDouble(),
    fontStyle: const NullableFontStyleConverter().fromJson(
      json['fontStyle'],
    ),
    fontWeight: const NullableFontWeightConverter().fromJson(
      json['fontWeight'],
    ),
    forceStrutHeight: json['forceStrutHeight'] == null
        ? null
        : (json['forceStrutHeight'] as bool),
    height: (json['height'] as num?)?.toDouble(),
    leading: (json['leading'] as num?)?.toDouble(),
    package: json['package'],
  );
}