updateObject method

Future<bool> updateObject()

Updates an object in the current opened box

Returns a Future

Implementation

Future<bool> updateObject() async {
  final boxValue = _hiveViewState.selectedBoxValue!;
  final currentBox = _hiveViewState.currentOpenedBox!;
  Map<String, dynamic> updatedObjectJson = {};
  int index = 0;
  if (_hiveViewState.objectNestedIndices!.isNotEmpty) {
    index = _hiveViewState.objectNestedIndices!.first.keys.single;
    updatedObjectJson = boxValue[index];
  } else {
    index = objectIndex!;
    updatedObjectJson = boxValue[index];
  }
  debugPrint(_hiveViewState.objectNestedIndices.toString());
  return await _updateBoxWithObject(
    currentBox,
    index,
    updatedObjectJson,
  );
}