add method

  1. @override
void add(
  1. EntityT element
)
override

Prepares to add the given target object to this relation.

To apply changes, call applyToDb or put the object with the ToMany. For important details, see the notes about relations of Box.put.

Implementation

@override
void add(EntityT element) {
  ArgumentError.checkNotNull(element, 'element');
  _track(element, 1);
  if (__items == null) {
    // We don't need to load old data from DB to add new items.
    _addedBeforeLoad.add(element);
  } else {
    _items.add(element);
  }
}