put method

int put(
  1. T object, {
  2. PutMode mode = PutMode.put,
})

Puts the given Object in the box (aka persisting it).

If this is a new object (its ID property is 0), a new ID will be assigned to the object (and returned).

If the object with given was already in the box, it will be overwritten.

Performance note: consider putMany to put several objects at once.

Implementation

int put(T object, {PutMode mode = PutMode.put}) {
  if (_hasRelations) {
    return InternalStoreAccess.runInTransaction(
        _store, TxMode.write, (Transaction tx) => _put(object, mode, tx));
  } else {
    return _put(object, mode, null);
  }
}