Remove function

Future<bool> Remove(
  1. String key
)

Implementation

Future<bool> Remove(String key) async {
  if (key.isEmpty) return false;

  var success = true;
  try {
    _expireCookie(Uri.encodeComponent(key));
    success = GetCookie(key) == null;
  } catch (_) {
    success = false;
  }

  _largeMemoryFallback.remove(key);
  try {
    final storage = web.window.localStorage;
    storage.removeItem(key);
    if (storage.getItem(key) != null) success = false;
  } catch (_) {
    // The cookie and in-memory value have still been removed, but persistent
    // storage could not be checked or cleared.
    success = false;
  }

  return success;
}