IndexSnapshot.fromMap constructor

IndexSnapshot.fromMap(
  1. String name,
  2. Map<String, dynamic> data
)

Creates an index snapshot from a map.

Implementation

factory IndexSnapshot.fromMap(String name, Map<String, dynamic> data) {
  _checkKeys(
    data,
    context: 'index "$name"',
    requiredKeys: const {'name', 'tableName', 'columns', 'isUnique'},
    optionalKeys: const {'where'},
  );
  return IndexSnapshot(
    name: name,
    tableName: data['tableName'] as String,
    // Materialize (not a lazy `.cast` view): these end up in DiffOperation
    // maps sent over an isolate SendPort, which rejects CastList instances.
    columns: List<String>.from(data['columns'] as List<dynamic>),
    isUnique: data['isUnique'] as bool? ?? false,
    where: data['where'] as String?,
  );
}