forPath static method
The instance owning storagePath, created on first use.
Throws a StateError if that path's instance is mid-close — see
_closing. Closing storage is a quiescent-point operation, so a caller
reaching this has a genuine ordering bug and wants to hear about it.
Implementation
static HiveInterface forPath(String storagePath) {
final key = canonicalPathFor(storagePath);
if (_closing.containsKey(key)) {
throw StateError('The Hive instance for "$key" is being closed. Await'
' the closeAll()/closeFor() future before opening storage there'
' again.');
}
return _byPath.putIfAbsent(key, () => HiveImpl()..init(key));
}