ManyToMany class

A many-to-many relationship resolved through a pivot table.

Inheritance

Constructors

ManyToMany({required dynamic model, required String pivotTable, required String foreignKey, required String relatedKey, String localKey = 'id', String relatedLocalKey = 'id', bool createPivot = false, bool pivotForeignKeys = false, String? onDelete, String? onUpdate})
Creates a many-to-many relationship via a pivot table.
const

Properties

createPivot bool
Whether the code generator should emit a CREATE TABLE IF NOT EXISTS statement for the pivotTable automatically.
final
foreignKey String
The foreign-key column of the relationship.
finalinherited
hashCode int
The hash code for this object.
no setterinherited
isCollection bool
True if the relationship returns a collection of models.
no setteroverride
localKey String
The local key column this relationship joins on.
finalinherited
model → dynamic
The target model for the relationship. Can be a String (table name) or a Type (Model class).
finalinherited
onDelete String?
Action applied when the referenced record is deleted.
finalinherited
onUpdate String?
Action applied when the referenced record is updated.
finalinherited
pivotForeignKeys bool
Whether the auto-generated pivot table (see createPivot) should also include FOREIGN KEY (...) REFERENCES ... ON DELETE CASCADE constraints for both pivot columns.
final
pivotTable String
The name of the pivot (join) table.
final
relatedKey String
The column in the pivot table that points to the related model.
final
relatedLocalKey String
The column in the related model that is referenced by relatedKey.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

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