clearConfiguration static method

void clearConfiguration()

Clears injected hub configuration (e.g. registry reset / dispose).

Also releases the group callbacks, so a host that disposes flutter_gemma gets background_downloader back in the state it found it — our group entry removed, its updates stream never having been touched.

Implementation

static void clearConfiguration() {
  _configuredDownloadUpdatesStream = null;
  _configuredBroadcastStream = null;
  // A host `FileDownloader().destroy()` clears `notificationConfigs` as well
  // as the callback map, and `_ensureConfigured` short-circuits on
  // `_isConfigured` — so without this a later `foreground: true` download
  // silently loses its notification, and with it the foreground service.
  _isConfigured = false;
  // absorb: the host is tearing us down, and a task we enqueued may still be
  // running. With no callback its updates fall through to
  // `FileDownloader().updates` and the host starts receiving tasks it has
  // never heard of.
  _releaseGroupFanOut(absorb: true);
}