disposeAppstraxServices function

Future<void> disposeAppstraxServices()

Releases what initializeAppstraxServices acquired.

Optional in an application that runs until the process ends, and necessary anywhere the SDK is set up more than once: a hot restart, a test suite, or switching which API the app talks to. Without it, each initialize left the previous client's connections open and the previous session's user in memory while Config pointed somewhere new.

The signed-in user is not signed out. The refresh token stays in secure storage, so a later initializeAppstraxServices restores the session as it would after a restart. Call appstraxAuth.logout() first to end it.

An httpClient passed to initializeAppstraxServices is left open, since it belongs to the application.

Implementation

Future<void> disposeAppstraxServices() async {
  appstraxAuth.http.close();
  appstraxAuth.resetInMemoryState();
}