fromMap static method

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

Creates a DiffOperation from a map representation.

Implementation

static DiffOperation fromMap(Map<String, dynamic> map) {
  final type = map['type'] as String;
  return switch (type) {
    'createTable' => CreateTable.fromMap(map),
    'dropTable' => DropTable.fromMap(map),
    'alterTable' => AlterTable.fromMap(map),
    'createIndex' => CreateIndex.fromMap(map),
    'dropIndex' => DropIndex.fromMap(map),
    _ => throw ArgumentError('Unknown operation type: $type'),
  };
}