connect method
Implementation
Future<bool> connect() async {
if (_box == null && _boxFuture == null) {
final completer = Completer<bool>();
_connectingFuture = completer.future;
if (_disconnectingFuture != null) {
await _disconnectingFuture;
}
try {
_boxFuture = Hive.openBox(key);
_box = await _boxFuture;
completer.complete(true);
} catch (error) {
completer.complete(false);
} finally {
_boxFuture = null;
}
}
return _connectingFuture!;
}