removeDataFor method Null safety

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 {
  List<String> dataTypesList = [];
  for (var dataType in dataTypes) {
    dataTypesList.add(dataType.toValue());
  }

  List<Map<String, dynamic>> recordList = [];
  for (var record in dataRecords) {
    recordList.add(record.toMap());
  }

  Map<String, dynamic> args = <String, dynamic>{};
  args.putIfAbsent("dataTypes", () => dataTypesList);
  args.putIfAbsent("recordList", () => recordList);
  await _staticChannel.invokeMethod('removeDataFor', args);
}