fromMap static method

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

Implementation

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

  var anonymousProfilePhotoIdNewDocmentId = map['anonymousProfilePhotoId'];
  if ((newDocumentIds != null) &&
      (anonymousProfilePhotoIdNewDocmentId != null)) {
    var anonymousProfilePhotoIdOldDocmentId =
        anonymousProfilePhotoIdNewDocmentId;
    anonymousProfilePhotoIdNewDocmentId = newRandomKey();
    newDocumentIds[anonymousProfilePhotoIdOldDocmentId] =
        anonymousProfilePhotoIdNewDocmentId;
  }
  var homePagesFromMap = map['homePages'];
  if (homePagesFromMap != null) {
    homePagesFromMap = AppHomePageReferencesEntity.fromMap(homePagesFromMap,
        newDocumentIds: newDocumentIds);
  }
  var logoIdNewDocmentId = map['logoId'];
  if ((newDocumentIds != null) && (logoIdNewDocmentId != null)) {
    var logoIdOldDocmentId = logoIdNewDocmentId;
    logoIdNewDocmentId = newRandomKey();
    newDocumentIds[logoIdOldDocmentId] = logoIdNewDocmentId;
  }

  return AppEntity(
    ownerID: map['ownerID'],
    title: map['title'],
    homeURL: map['homeURL'],
    email: map['email'],
    description: map['description'],
    appStatus: map['appStatus'],
    anonymousProfilePhotoId: anonymousProfilePhotoIdNewDocmentId,
    homePages: homePagesFromMap,
    logoId: logoIdNewDocmentId,
    styleFamily: map['styleFamily'],
    styleName: map['styleName'],
    autoPrivileged1: map['autoPrivileged1'],
    isFeatured: map['isFeatured'],
    includeShippingAddress: map['includeShippingAddress'],
    includeInvoiceAddress: map['includeInvoiceAddress'],
    includeSubscriptions: map['includeSubscriptions'],
    welcomeMessage: map['welcomeMessage'],
  );
}