fromMap static method

FontEntity? fromMap(
  1. Object? o, {
  2. Map<String, String>? newDocumentIds,
})

Implementation

static FontEntity? fromMap(Object? o, {Map<String, String>? newDocumentIds}) {
  if (o == null) return null;
  var map = o as Map<String, dynamic>;

  var colorFromMap = map['color'];
  if (colorFromMap != null) {
    colorFromMap =
        RgbEntity.fromMap(colorFromMap, newDocumentIds: newDocumentIds);
  }

  return FontEntity(
    fontName: map['fontName'],
    size: double.tryParse(map['size'].toString()),
    weight: map['weight'],
    style: map['style'],
    decoration: map['decoration'],
    color: colorFromMap,
  );
}