Schema class Null safety
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.
Constructors
-
Schema(List<
SchemaTable> tables) -
Creates an instance of this type with a specific set of
tables
. - Schema.empty()
- 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
.
Properties
- hashCode → int
-
The hash code for this object.
read-onlyinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
read-onlyinherited
-
tables
→ List<
SchemaTable> -
The tables in this database.
read-only
Methods
-
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 non-existent method or property is accessed.
inherited
-
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.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
-
operator [](
String tableName) → SchemaTable? - Gets a table from tables by that table's name.