clearSelectedFiles method

Future<void> clearSelectedFiles()

Bulk-delete all files in one API call (mirrors clearSelectedImages).

Implementation

Future<void> clearSelectedFiles() async {
  if (enableApiDeletion) {
    // Only files that already exist in the DB need an API call.
    final dbFiles = files
        .where((f) => f.idAddonsFunDtls != null && f.idAddonsFunDtls != 0)
        .toList();

    if (dbFiles.isNotEmpty) {
      await deActivateAddOnsBulk(dbFiles, onSuccess: () {
        files.clear();
      });
    } else {
      // Local-only files — just clear the list.
      files.clear();
    }
  } else {
    files.clear();
  }
}