fromMap static method

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

Implementation

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

  var backgroundOverrideFromMap = map['backgroundOverride'];
  if (backgroundOverrideFromMap != null) {
    backgroundOverrideFromMap = BackgroundEntity.fromMap(
        backgroundOverrideFromMap,
        newDocumentIds: newDocumentIds);
  }
  var popupMenuBackgroundColorFromMap = map['popupMenuBackgroundColor'];
  if (popupMenuBackgroundColorFromMap != null) {
    popupMenuBackgroundColorFromMap = RgbEntity.fromMap(
        popupMenuBackgroundColorFromMap,
        newDocumentIds: newDocumentIds);
  }
  var headerBackgroundOverrideFromMap = map['headerBackgroundOverride'];
  if (headerBackgroundOverrideFromMap != null) {
    headerBackgroundOverrideFromMap = BackgroundEntity.fromMap(
        headerBackgroundOverrideFromMap,
        newDocumentIds: newDocumentIds);
  }
  var popupMenuBackgroundColorOverrideFromMap =
      map['popupMenuBackgroundColorOverride'];
  if (popupMenuBackgroundColorOverrideFromMap != null) {
    popupMenuBackgroundColorOverrideFromMap = RgbEntity.fromMap(
        popupMenuBackgroundColorOverrideFromMap,
        newDocumentIds: newDocumentIds);
  }

  return DrawerEntity(
    appId: map['appId'],
    name: map['name'],
    backgroundOverride: backgroundOverrideFromMap,
    headerText: map['headerText'],
    secondHeaderText: map['secondHeaderText'],
    headerHeight: double.tryParse(map['headerHeight'].toString()),
    popupMenuBackgroundColor: popupMenuBackgroundColorFromMap,
    headerBackgroundOverride: headerBackgroundOverrideFromMap,
    popupMenuBackgroundColorOverride: popupMenuBackgroundColorOverrideFromMap,
    menuId: map['menuId'],
  );
}