Flutter API reference
Every export is fully typed. The signatures and props below come from the package's own reference documentation, so what is listed here is what the installed version ships.
Components
SignIn
component
SignIn is a pre-built Flutter widget that drives the full sign-in loop using the Choreo Identity & Access Management 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'), )
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'),
)
SignInButton
component
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
| Name | Type | Description |
|---|---|---|
| onTap (required) | 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. |
import 'package:thunderid_flutter/thunderid_flutter.dart';
SignInButton(
onTap: () {
// Navigate to your sign-in screen
Navigator.of(context).push(
MaterialPageRoute(builder: (_) => const AuthScreen()),
);
},
)
SignOutButton
component
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
| Name | Type | Description |
|---|---|---|
| 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. |
import 'package:thunderid_flutter/thunderid_flutter.dart';
SignOutButton(
onSignOutComplete: () {
// Optional: navigate or show a confirmation after sign-out
},
)
SignUp
component
SignUp is a pre-built Flutter widget that drives the full registration flow using the Choreo Identity & Access Management 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'), )
import 'package:thunderid_flutter/thunderid_flutter.dart';
SignUp(
applicationId: '<your-application-id>',
onComplete: () {
ThunderIDProvider.of(context).refresh();
},
onError: (error) => print('Sign up failed: $error'),
)
SignedIn
component
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
| Name | Type | Description |
|---|---|---|
| child (required) | 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. |
import 'package:thunderid_flutter/thunderid_flutter.dart';
SignedIn(
child: const HomeScreen(),
fallback: const AuthScreen(),
)
SignedOut
component
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
| Name | Type | Description |
|---|---|---|
| child (required) | 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. |
import 'package:thunderid_flutter/thunderid_flutter.dart';
SignedOut(
child: const AuthScreen(),
fallback: const HomeScreen(),
)
UserProfile
component
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')), ); }, )
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')),
);
},
)
ChangeCredential
component
The ChangeCredential widget lets a signed-in user set a new value for one of their own credentials. It validates against the user type schema (GET /users/me/meta) and posts the change via ThunderIDClient.updateUserCredentials. Defaults to password; set attribute for another credential, such as a PIN. Requires a ThunderIDProvider ancestor. Collects only a new value and its confirmation, not the current one, since the write path does not verify it today.
Parameters
| Name | Type | Description |
|---|---|---|
| attribute (optional) | String | The credential attribute this instance manages, any attribute the user type schema declares credential: true for. Defaults to 'password'. |
| onSuccess (optional) | VoidCallback? | Called after the credential has been changed successfully. |
| showDivider (optional) | bool | Whether to draw the row's bottom divider, matching UserProfile's field rows. Defaults to true. |
import 'package:thunderid_flutter/thunderid_flutter.dart';
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: const [
Text('Security'),
ChangeCredential(),
],
)
Functions
Configuration
function
ThunderIDConfig is the configuration class passed to ThunderIDProvider and to ThunderIDClient.initialize().
Parameters
| Name | Type | Description |
|---|---|---|
| baseUrl | String | Required. Your Choreo Identity & Access Management instance URL. Must use HTTPS (e.g., https://<DATA_PLANE_URL>). |
| clientId | String? | The Client ID from your Choreo Identity & Access Management 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 Choreo Identity & Access Management 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. |
import 'package:thunderid_flutter/thunderid_flutter.dart';
final config = ThunderIDConfig(
baseUrl: 'https://<DATA_PLANE_URL>',
clientId: '<your-client-id>',
scopes: const ['openid', 'profile', 'email'],
afterSignInUrl: 'dev.thunderid.app://callback',
afterSignOutUrl: 'dev.thunderid.app://logout',
applicationId: '<your-application-id>',
);
ThunderIDClient
function
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 Choreo Identity & Access Management 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.
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://<DATA_PLANE_URL>',
clientId: '<your-client-id>',
scopes: const ['openid', 'profile', 'email'],
),
);
ThunderIDState
function
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).
import 'package:flutter/material.dart';
import 'package:thunderid_flutter/thunderid_flutter.dart';
void main() {
runApp(
ThunderIDProvider(
config: ThunderIDConfig(
baseUrl: 'https://<DATA_PLANE_URL>',
clientId: '<your-client-id>',
afterSignInUrl: 'dev.thunderid.app://callback',
afterSignOutUrl: 'dev.thunderid.app://logout',
),
child: const MyApp(),
),
);
}
Was this page helpful?