fromMap static method

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

Implementation

static DividerEntity? 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);
  }
  var conditionsFromMap = map['conditions'];
  if (conditionsFromMap != null) {
    conditionsFromMap = StorageConditionsEntity.fromMap(conditionsFromMap,
        newDocumentIds: newDocumentIds);
  }

  return DividerEntity(
    appId: map['appId'],
    description: map['description'],
    color: colorFromMap,
    height: double.tryParse(map['height'].toString()),
    thickness: double.tryParse(map['thickness'].toString()),
    indent: double.tryParse(map['indent'].toString()),
    endIndent: double.tryParse(map['endIndent'].toString()),
    conditions: conditionsFromMap,
  );
}