FontModel.fromJson constructor

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

Implementation

factory FontModel.fromJson(Map<String, dynamic> json) {
  Map<int, String>? fontWeights;
  if (json["fontWeights"] != null) {
    fontWeights = json["fontWeights"]
        .map((key, value) => MapEntry(int.parse(key), value))
        .cast<int, String>();
  }
  return FontModel(
    fontFamily: json["fontFamily"],
    fontUrl: json["fontUrl"],
    fontWeights: fontWeights,
  );
}