clear method
Clears data.
Implementation
@override
Future<bool?> clear() async {
if (isLocalStorageSupported()) {
for (var key in window.localStorage.keys) {
if (key.startsWith(namespace)) {
removeLocal(key);
}
}
} else {
String? cookie = document.cookie;
if (cookie != null && cookie.isNotEmpty) {
List<String> cookies = cookie.split(';');
for (String cookieValue in cookies) {
List<String> parts = cookieValue.trim().split('=');
if (parts[0].startsWith(namespace)) {
String key = parts[0];
document.cookie =
'$key=; expires=Thu, 01 Jan 1970 00:00:00 UTC; path=/';
}
}
}
}
return true;
}