dispose method

void dispose()

Removes the lifecycle observer and resets internal state.

Re-initialization behaviour: _instance is intentionally not nulled here, so instance continues to return this same object. Setting _initialized = false means a subsequent initialize call will re-register the observer and count another cold-start session — this is intentional in tests (where tearDown disposes and re-initializes) but callers should avoid calling dispose mid-session in production unless they intend to fully restart tracking.

Implementation

void dispose() {
  WidgetsBinding.instance.removeObserver(this);
  _initialized = false;
  _initCompleter = null;
  _isStartingSession = false;
  _pausedAtMs = null;
  pendingSessionFuture = null;
}