@@ -87,6 +87,9 @@ class ToMany<EntityT> extends Object with ListMixin<EntityT> {
8787 _items.length = newLength;
8888 }
8989
90+ /// Gets the target object at the given index.
91+ ///
92+ /// [ToMany] uses lazy initialization, so on first access this will read the target objects from the database.
9093 @override
9194 EntityT operator [](int index) => _items[index];
9295
@@ -104,6 +107,10 @@ class ToMany<EntityT> extends Object with ListMixin<EntityT> {
104107 _track (element, 1 );
105108 }
106109
110+ /// Prepares to add the given target object to this relation.
111+ ///
112+ /// To apply changes, call [applyToDb] or put the object with the ToMany.
113+ /// For important details, see the notes about relations of [Box.put] .
107114 @override
108115 void add (EntityT element) {
109116 ArgumentError .checkNotNull (element, 'element' );
@@ -116,6 +123,7 @@ class ToMany<EntityT> extends Object with ListMixin<EntityT> {
116123 }
117124 }
118125
126+ /// Like [add] , but for multiple target objects.
119127 @override
120128 void addAll (Iterable <EntityT > iterable) {
121129 iterable.forEach (_track);
@@ -127,8 +135,11 @@ class ToMany<EntityT> extends Object with ListMixin<EntityT> {
127135 }
128136 }
129137
130- // note: to override, arg must be "Object", same as in the base class.
131- @override
138+ /// Prepares to remove the target object from this relation.
139+ ///
140+ /// To apply changes, call [applyToDb] or put the object with the ToMany.
141+ /// For important details, see the notes about relations of [Box.put] .
142+ @override // note: to override, arg must be "Object", same as in the base class.
132143 bool remove (Object ? element) {
133144 if (! _items.remove (element)) return false ;
134145 if (element != null ) _track (element as EntityT , - 1 );
0 commit comments