clear method
Completes with true once the storage for the app has been cleared.
Implementation
@nonVirtual
@override
Future<void> clear([Options? options]) {
assert(_debugAssertNotDisposed());
return _enqueueWritingTask(this, () async {
final keys = (await _useStorage((s) => s.readAll(options))).keys;
return await useStorageWithHandlers(
(s) => s.clear(options),
(_, __) {
sendChange({for (final k in keys) k: KeyAndValue(k, null, Null)});
if (_isLogEnabled) {
_publishLog(ClearSuccessEvent(options));
}
},
(error, _) {
if (_isLogEnabled) {
_publishLog(ClearFailureEvent(error, options));
}
},
);
});
}