Database.fromMap constructor

Database.fromMap(
  1. Map<String, dynamic> map
)

Implementation

factory Database.fromMap(Map<String, dynamic> map) {
  return Database(
    $id: map['\$id'].toString(),
    name: map['name'].toString(),
    $createdAt: map['\$createdAt'].toString(),
    $updatedAt: map['\$updatedAt'].toString(),
    enabled: map['enabled'],
    type: enums.DatabaseType.values.firstWhere((e) => e.value == map['type']),
    status: map['status'] != null
        ? enums.DatabaseStatus.values
            .firstWhere((e) => e.value == map['status'])
        : null,
    engine: map['engine']?.toString(),
    specification: map['specification']?.toString(),
    replicas: map['replicas'],
    policies: map['policies'] != null
        ? List<BackupPolicy>.from(
            map['policies'].map((p) => BackupPolicy.fromMap(p)))
        : null,
    archives: map['archives'] != null
        ? List<BackupArchive>.from(
            map['archives'].map((p) => BackupArchive.fromMap(p)))
        : null,
  );
}