logout method
Logs out the user from the Kinde session.
For web platforms, this redirects to logoutRedirectUri.
For mobile/desktop, uses FlutterAppAuth.endSession() with proper redirect handling.
Parameters:
dio- Optional Dio client for direct HTTP logout fallback (macOS only)macosLogoutWithoutRedirection- On macOS, use direct HTTP logout without browser redirect (default: true)timeout- Timeout duration for logout request (default: 30 seconds)
Implementation
Future<void> logout({
Dio? dio,
bool macosLogoutWithoutRedirection = true,
Duration timeout = const Duration(seconds: 30),
}) async {
if (authState == null) {
kindeDebugPrint(methodName: "logout", message: "AuthState is null.");
return;
}
if (kIsWeb) {
await _handleWebLogout();
} else {
await _handleNonWebLogout(
dio: dio,
macosLogoutWithoutRedirection: macosLogoutWithoutRedirection,
timeout: timeout);
}
await _commonLogoutCleanup();
}