handleAboutToLogOut method

  1. @override
Future<void> handleAboutToLogOut()
override

Public handler for pre-logout cleanup.

This method can be passed to AuthService constructor for race-free initialization. It unregisters the device before logout completes.

Usage

// Race-free initialization pattern:
final deviceService = DeviceServiceImpl();
final auth = AuthServiceImpl(
  firebaseApp: app,
  onAboutToLogOutCallbacks: [deviceService.handleAboutToLogOut],
);

Behavior

Calls unregisterDevice to delete the device document from Firestore. This is best-effort and should never block logout.

Implementation

@override
Future<void> handleAboutToLogOut() async {
  logd('DeviceService: handleAboutToLogOut called');
  await unregisterDevice();
}