Collection.fromMap constructor

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

Implementation

factory Collection.fromMap(
  Map<String, dynamic> map,
) {
  map = {
    '\$id': "",
    '\$createdAt': "",
    '\$updatedAt': "",
    '\$permissions': [],
    'databaseId': "",
    'name': "",
    'description': "",
    'enabled': true,
    'documentSecurity': false,
    'attributes': [],
    'indexes': [],
    'bytesMax': 0,
    'bytesUsed': 0,
    ...map,
  };

  return Collection(
    $id: map['\$id'].toString(),
    $createdAt: map['\$createdAt'].toString(),
    $updatedAt: map['\$updatedAt'].toString(),
    $permissions: List.from(map['\$permissions'] ?? []),
    databaseId: map['databaseId'].toString(),
    name: map['name'].toString(),
    description: map['description'].toString(),
    enabled: map['enabled'],
    documentSecurity: map['documentSecurity'],
    attributes: List.from(map['attributes'] ?? []),
    indexes: List<Index>.from(
      map['indexes'].map((p) => Index.fromMap(p)),
    ),
    bytesMax: map['bytesMax'],
    bytesUsed: map['bytesUsed'],
  );
}