Skip to main content

API reference

The public surface of

thunderid_flutter, as documented in its reference pages.

componentSignIn

`SignIn` is a pre-built Flutter widget that drives the full sign-in loop using the ThunderID Flow Execution API. It renders the appropriate input form for each authentication step (username/password, TOTP, email OTP, etc.) and automatically advances through the flow until completion. ```dart import 'package:thunderid_flutter/thunderid_flutter.dart'; SignIn( applicationId: '', onComplete: () { // Refresh state after sign-in ThunderIDProvider.of(context).refresh(); }, onError: (error) => print('Sign in failed: $error'), ) ```

Example
import 'package:thunderid_flutter/thunderid_flutter.dart';

SignIn(
  applicationId: '<your-application-id>',
  onComplete: () {
    // Refresh state after sign-in
    ThunderIDProvider.of(context).refresh();
  },
  onError: (error) => print('Sign in failed: $error'),
)
componentSignInButton

`SignInButton` is a pre-styled `ElevatedButton` widget that triggers your sign-in flow when tapped. ```dart import 'package:thunderid_flutter/thunderid_flutter.dart'; SignInButton( onTap: () { // Navigate to your sign-in screen Navigator.of(context).push( MaterialPageRoute(builder: (_) => const AuthScreen()), ); }, ) ```

Parameters
onTaprequired
VoidCallback

Called when the button is tapped. Implement your navigation or sign-in logic here.

label
String?

Override the button label. Defaults to the localized `"Sign In"` string.

style
ButtonStyle?

Override the `ElevatedButton` style.

Example
import 'package:thunderid_flutter/thunderid_flutter.dart';

SignInButton(
  onTap: () {
    // Navigate to your sign-in screen
    Navigator.of(context).push(
      MaterialPageRoute(builder: (_) => const AuthScreen()),
    );
  },
)
componentSignOutButton

`SignOutButton` is a pre-styled `OutlinedButton` widget that calls `signOut()` on tap and notifies the parent `ThunderIDProvider` to refresh auth state. ```dart import 'package:thunderid_flutter/thunderid_flutter.dart'; SignOutButton( onSignOutComplete: () { // Optional: navigate or show a confirmation after sign-out }, ) ```

Parameters
onSignOutComplete
VoidCallback?

Called after sign-out completes and the provider state is refreshed.

label
String?

Override the button label. Defaults to the localized `"Sign Out"` string.

style
ButtonStyle?

Override the `OutlinedButton` style.

Example
import 'package:thunderid_flutter/thunderid_flutter.dart';

SignOutButton(
  onSignOutComplete: () {
    // Optional: navigate or show a confirmation after sign-out
  },
)
componentSignUp

`SignUp` is a pre-built Flutter widget that drives the full registration flow using the ThunderID Flow Execution API. It renders each registration step as it arrives and advances through the flow until the account is created and the user is signed in. ```dart import 'package:thunderid_flutter/thunderid_flutter.dart'; SignUp( applicationId: '', onComplete: () { ThunderIDProvider.of(context).refresh(); }, onError: (error) => print('Sign up failed: $error'), ) ```

Example
import 'package:thunderid_flutter/thunderid_flutter.dart';

SignUp(
  applicationId: '<your-application-id>',
  onComplete: () {
    ThunderIDProvider.of(context).refresh();
  },
  onError: (error) => print('Sign up failed: $error'),
)
componentSignedIn

`SignedIn` is a guard widget that renders its `child` only when the user is authenticated. When the user is not signed in it renders `fallback` instead (or nothing, if no fallback is provided). This widget re-renders automatically whenever the auth state in the parent `ThunderIDProvider` changes.

Parameters
childrequired
Widget

Rendered when `ThunderIDProvider.of(context).isSignedIn` is `true`.

fallback
Widget?

Rendered when the user is not signed in. Defaults to `const SizedBox.shrink()` if omitted.

Example
import 'package:thunderid_flutter/thunderid_flutter.dart';

SignedIn(
  child: const HomeScreen(),
  fallback: const AuthScreen(),
)
componentSignedOut

`SignedOut` is a guard widget that renders its `child` only when the user is **not** authenticated. When the user is signed in it renders `fallback` instead (or nothing, if no fallback is provided). This widget re-renders automatically whenever the auth state in the parent `ThunderIDProvider` changes.

Parameters
childrequired
Widget

Rendered when `ThunderIDProvider.of(context).isSignedIn` is `false`.

fallback
Widget?

Rendered when the user is signed in. Defaults to `const SizedBox.shrink()` if omitted.

Example
import 'package:thunderid_flutter/thunderid_flutter.dart';

SignedOut(
  child: const AuthScreen(),
  fallback: const HomeScreen(),
)
componentUserProfile

`UserProfile` is a pre-built form widget for viewing and editing the authenticated user's profile. It loads the user's profile from `/scim2/Me` on mount, renders editable fields, and saves changes via `updateUserProfile`. ```dart import 'package:thunderid_flutter/thunderid_flutter.dart'; UserProfile( onSaved: (updatedUser) { ScaffoldMessenger.of(context).showSnackBar( const SnackBar(content: Text('Profile updated')), ); }, onError: (error) { ScaffoldMessenger.of(context).showSnackBar( SnackBar(content: Text('Failed to update: $error')), ); }, ) ```

Example
import 'package:thunderid_flutter/thunderid_flutter.dart';

UserProfile(
  onSaved: (updatedUser) {
    ScaffoldMessenger.of(context).showSnackBar(
      const SnackBar(content: Text('Profile updated')),
    );
  },
  onError: (error) {
    ScaffoldMessenger.of(context).showSnackBar(
      SnackBar(content: Text('Failed to update: $error')),
    );
  },
)
functionConfiguration

`ThunderIDConfig` is the configuration class passed to `ThunderIDProvider` and to `ThunderIDClient.initialize()`.

Parameters
baseUrl
String

**Required.** Your ThunderID instance URL. Must use HTTPS (e.g., `https://localhost:8090`).

clientId
String?

The Client ID from your ThunderID application. Required for redirect-based authentication and token operations.

scopes
List

OAuth 2.0 scopes to request. Include `'profile'` and `'email'` to receive user identity claims.

afterSignInUrl
String?

The redirect URI to return to after sign-in. Must match an **Allowed Redirect URI** registered in the console.

afterSignOutUrl
String?

The redirect URI to return to after sign-out. Must match an **Allowed Post-Logout Redirect URI** in the console.

signInUrl
String?

Override the sign-in URL. Defaults to the ThunderID hosted sign-in page.

signUpUrl
String?

Override the sign-up URL.

applicationId
String?

The Application ID used for app-native (embedded) sign-in flows via the Flow Execution API.

organizationHandle
String?

The organization handle for multi-tenant deployments.

tokenValidation
TokenValidationConfig?

Controls ID token validation behavior.

preferences
ThunderIDPreferences?

UI theme and localization preferences.

Example
import 'package:thunderid_flutter/thunderid_flutter.dart';

final config = ThunderIDConfig(
  baseUrl: 'https://localhost:8090',
  clientId: '<your-client-id>',
  scopes: const ['openid', 'profile', 'email'],
  afterSignInUrl: 'dev.thunderid.app://callback',
  afterSignOutUrl: 'dev.thunderid.app://logout',
  applicationId: '<your-application-id>',
);
functionThunderIDClient

`ThunderIDClient` is the core authentication client in the `thunderid_flutter` package. It manages the full authentication lifecycle: initialization, sign-in (both app-native and redirect-based), session, token management, and user profile operations. All protocol operations are delegated to the native ThunderID iOS and Android SDKs via Flutter platform channels. When you use `ThunderIDProvider`, a `ThunderIDClient` instance is created and managed automatically. Access it via `ThunderIDProvider.of(context).client` from any widget.

Example
import 'package:thunderid_flutter/thunderid_flutter.dart';

// Access via ThunderIDProvider (recommended)
final thunder = ThunderIDProvider.of(context);
final token = await thunder.client.getAccessToken();

// Or create directly (advanced)
final client = ThunderIDClient();
await client.initialize(
  config: ThunderIDConfig(
    baseUrl: 'https://localhost:8090',
    clientId: '<your-client-id>',
    scopes: const ['openid', 'profile', 'email'],
  ),
);
functionThunderIDState

`ThunderIDState` is the reactive authentication state object provided by `ThunderIDProvider`. It holds the current user, loading state, and initialization status, and exposes the underlying `ThunderIDClient` for direct API calls. Access `ThunderIDState` from any widget using `ThunderIDProvider.of(context)`.

Example
import 'package:flutter/material.dart';
import 'package:thunderid_flutter/thunderid_flutter.dart';

void main() {
  runApp(
    ThunderIDProvider(
      config: ThunderIDConfig(
        baseUrl: 'https://localhost:8090',
        clientId: '<your-client-id>',
        afterSignInUrl: 'dev.thunderid.app://callback',
        afterSignOutUrl: 'dev.thunderid.app://logout',
      ),
      child: const MyApp(),
    ),
  );
}
ThunderID LogoThunderID Logo

Product

DocsAPIsSDKs
© Copyright Linux Foundation Europe.For web site terms of use, trademark policy and other project policies please see https://linuxfoundation.eu/en/policies.