updateById method

Future<T?> updateById(
  1. int id, {
  2. required T value,
})

Update By Id in Box<T>

Return newValue

Implementation

Future<T?> updateById(int id, {required T value}) async {
  final addedValue = await getById(id);
  if (addedValue != null) {
    // delete
    await deleteById(_adapter.getId(addedValue));
  }
  //update
  return await add(value);
}