delete method

  1. @override
void delete(
  1. Uri uri, [
  2. bool withDomainSharedCookie = false
])
override

Delete cookies for specified uri. This API will delete all cookies for the uri.host, it will ignored the uri.path.

withDomainSharedCookie true will delete the domain-shared cookies.

Implementation

@override
void delete(Uri uri, [bool withDomainSharedCookie = false]) {
  super.delete(uri, withDomainSharedCookie);
  final host = uri.host;
  File file;
  if (_cookieDomains!.remove(host)) {
    file = File('$_dir.index');
    file.writeAsStringSync(json.encode(_cookieDomains));
  }
  file = File('$_dir$host');
  if (file.existsSync()) {
    file.delete();
  }
  if (withDomainSharedCookie) {
    file = File('$_dir.domains');
    file.writeAsStringSync(json.encode(domains[0]));
  }
}