OneToMany class

Defines a one-to-many relationship.

Fields with this annotation must be of type List<T> or Future<List<T>>.

Example:

@OneToMany(mappedBy: 'author')
late List<Book> books;
Annotations
  • @Target.new({TargetKind.field})

Constructors

OneToMany({FetchType fetch = FetchType.lazy, List<CascadeType> cascade = const [], String? mappedBy})
const

Properties

cascade List<CascadeType>
The cascade strategies to apply.
final
fetch FetchType
The fetch strategy (eager or lazy).
final
hashCode int
The hash code for this object.
no setterinherited
mappedBy String?
The name of the field in the related entity that maps back to this one.
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