removeDataFor method

Future<void> removeDataFor({
  1. required Set<IOSWKWebsiteDataType> dataTypes,
  2. required List<IOSWKWebsiteDataRecord> dataRecords,
})

Removes website data of the given types for the given data records.

dataTypes represents the website data types that should be removed.

dataRecords represents the website data records to delete website data for.

Implementation

Future<void> removeDataFor(
    {required Set<IOSWKWebsiteDataType> dataTypes,
    required List<IOSWKWebsiteDataRecord> dataRecords}) async {
  Set<WebsiteDataType> dataTypesList = Set();
  for (var dataType in dataTypes) {
    dataTypesList
        .add(WebsiteDataType.fromNativeValue(dataType.toNativeValue())!);
  }

  List<WebsiteDataRecord> recordList = [];
  for (var record in dataRecords) {
    recordList.add(WebsiteDataRecord.fromMap(record.toMap())!);
  }

  await WebStorageManager.instance()
      .removeDataFor(dataRecords: recordList, dataTypes: dataTypesList);
}