dispose method

Future<void> dispose()

Cleans up resources used by SuperFCM.

This should be called when the SuperFCM instance is no longer needed. Performs the following cleanup:

  • Disposes managers and services
  • Clears callbacks
  • Clears pending operations

Implementation

Future<void> dispose() async {
  logger.d('Disposing SuperFCM');
  await RequestManager.instance.dispose();
  await CacheManager.instance.dispose();
  await FirebaseMessagingService.instance.dispose();
  await SessionManager.instance.dispose();

  // Clear references
  _onForegroundCallback = null;
  _onOpenedCallback = null;
  _pendingOperations.clear();

  logger.d('SuperFCM disposed');
}