ModelDefinition class

Parsed model declaration.

Annotations
  • @immutable

Constructors

ModelDefinition({required String name, required List<FieldDefinition> fields, List<ModelAttribute> attributes = const <ModelAttribute>[], int? line, int? column})
Creates a model definition.
const

Properties

attributes → List<ModelAttribute>
Model-level attributes such as @@id and @@unique.
final
column → int?
One-based source column where the model block starts, if known.
final
compoundUniqueFieldSets → Iterable<List<String>>
Compound unique field sets declared through @@unique.
no setter
databaseName → String
Database table name after applying @@map, if present.
no setter
fields → List<FieldDefinition>
Field declarations in source order.
final
hashCode → int
The hash code for this object.
no setterinherited
isIgnored → bool
Whether this model is excluded with @@ignore.
no setter
line → int?
One-based source line where the model block starts, if known.
final
name → String
Model name from the schema.
final
primaryKeyFields → List<String>
Field names that make up the model primary key.
no setter
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited

Methods

attribute(String name) → ModelAttribute?
Finds the first model-level attribute named name.
attributeFieldNames(String name) → List<String>
Returns field names declared by a list-style model attribute.
attributesNamed(String name) → Iterable<ModelAttribute>
Iterates over model-level attributes named name.
findField(String name) → FieldDefinition?
Finds a field by its schema name.
findFieldByDatabaseName(String databaseName) → FieldDefinition?
Finds a field by its mapped database column name.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() → String
A string representation of this object.
inherited
withoutIgnoredFields() → ModelDefinition
Returns a copy of this model without @ignore fields.

Operators

operator ==(Object other) → bool
The equality operator.
inherited