close method
Closes the storage instance, freeing any allocated resources. A storage instance can no longer be used once it is closed.
Implementation
@override
Future<void> close() async {
if (_closed) return;
await _lock.synchronized(() async {
if (_closed) return;
_closed = true;
_cache.clear();
_cachedBytes = 0;
// Closing releases the lock; only then may this isolate open the
// directory again.
try {
await _lockFile.close();
} finally {
_openDirectories.remove(_directory.path);
}
});
}