cancelAll method

Future<void> cancelAll()

Implementation

Future<void> cancelAll() async {
  var docIds = [];
  docIds.addAll(documents.keys.toList());
  for (var docPath in docIds) {
    if (documents.containsKey(docPath)) {
      try {
        await documents[docPath]?.cancel();
      } catch (e) {
        printDebug(e);
      }
      documents.remove(docPath);
      printDebug('Cancelling document reference: $docPath');
    }
  }

  var colIds = [];
  colIds.addAll(collections.keys.toList());
  for (var colPath in colIds) {
    if (collections.containsKey(colPath)) {
      try {
        await collections[colPath]?.cancel();
      } catch (e) {
        printDebug(e);
      }
      collections.remove(colPath);
      printDebug('Cancelling collection reference: $colPath');
    }
  }
}