add method
Adds a value and returns its generated key, updating the index.
Implementation
@override
Future<int> add(T value) {
if (nativeBox.isIntKey) {
return _lock.operation("ADD").run(() async {
final id = await nativeBox.add(value);
await _engine.onPut(id as K, value);
_invalidateTokensFor(value);
await _stampSnapshot();
return id;
});
} else {
throw InvalidAddOperationException<K>(boxName: name);
}
}