dispose method
Implementation
Future<void> dispose() async {
if (_instance != null) {
pauseSync();
await Future.wait([
..._managers.allManagers.map((m) => m.dispose()),
..._managerSubscriptions.map((s) => s.cancel()),
]);
await _connectivitySubscription?.cancel();
await _eventController.close();
await _userChangeController.close();
await _metricsSubject.close();
await _statusSubject.close();
}
if (_instance == this) {
_instance = null;
}
}