dispose method

Future<void> dispose()

Releases this runtime and its platform resources.

Dispose the active service before creating one with a different configuration.

Implementation

Future<void> dispose() async {
  if (_disposed) return;
  final wasInitialized = _initialized;
  _disposed = true;
  _initialized = false;
  if (wasInitialized) WidgetsBinding.instance.removeObserver(this);
  await _factory?.dispose();
  await _permissionStatusController.close();
  if (identical(_activeInstance, this)) _activeInstance = null;
}