Schema class

A portable representation of a database schema.

Instances of this type contain the database-only details of a ManagedDataModel and are typically instantiated from ManagedDataModels. The purpose of this type is to have a portable, differentiable representation of an application's data model for use in external tooling.


Schema(List<SchemaTable> tables)
Creates an instance of this type with a specific set of tables.
Creates an empty schema.
Schema.from(Schema otherSchema)
Creates a deep copy of otherSchema.
Schema.fromDataModel(ManagedDataModel dataModel)
Creates an instance of this type from dataModel.
Schema.fromMap(Map<String, dynamic> map)
Creates a instance of this type from map.


hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
tables List<SchemaTable?>?
The tables in this database.
no setter


addTable(SchemaTable table) → void
Adds a table to this instance.
asMap() Map<String, dynamic>
Emits this instance as a transportable Map.
differenceFrom(Schema otherSchema) SchemaDifference
The differences between two schemas.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
removeTable(SchemaTable table) → void
Removes a table from this instance.
renameTable(SchemaTable table, String newName) → void
replaceTable(SchemaTable existingTable, SchemaTable newTable) → void
tableForName(String name) SchemaTable?
Returns a SchemaTable for name.
toString() String
A string representation of this object.


operator ==(Object other) bool
The equality operator.
operator [](String tableName) SchemaTable
Gets a table from tables by that table's name.