Skip to main content

ThunderIDUserProfile

ThunderIDUserProfile 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.

import 'package:thunderid_flutter/thunderid_flutter.dart';

ThunderIDUserProfile(
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')),
);
},
)

ThunderIDUserProfile Parameters

ParameterTypeRequiredDescription
onSavedvoid Function(User)Called with the updated User after a successful profile save.
onErrorvoid Function(dynamic)?Called if loading or saving the profile fails.

BaseThunderIDUserProfile

BaseThunderIDUserProfile exposes the profile state and save action to a builder function, giving full control over the form layout.

BaseThunderIDUserProfile(
onSaved: (user) => print('Saved: ${user.displayName}'),
builder: (context, state) {
if (state.isLoading && state.firstName == null) {
return const CircularProgressIndicator();
}

return Column(
children: [
TextFormField(
initialValue: state.firstName,
decoration: const InputDecoration(labelText: 'First Name'),
onChanged: (v) => state.firstName = v,
),
TextFormField(
initialValue: state.lastName,
decoration: const InputDecoration(labelText: 'Last Name'),
onChanged: (v) => state.lastName = v,
),
TextFormField(
initialValue: state.email,
decoration: const InputDecoration(labelText: 'Email'),
onChanged: (v) => state.email = v,
),
ElevatedButton(
onPressed: state.isLoading ? null : state.save,
child: state.isLoading
? const CircularProgressIndicator()
: const Text('Save'),
),
if (state.error != null) Text(state.error!),
],
);
},
)

BaseThunderIDUserProfile Parameters

ParameterTypeRequiredDescription
onSavedvoid Function(User)Called after a successful save.
onErrorvoid Function(dynamic)?Called on error.
builderWidget Function(BuildContext, ProfileState)Builder receiving the current ProfileState.

ProfileState

ProfileState is passed to the BaseThunderIDUserProfile builder on every update.

Property/MethodTypeDescription
firstNameString?Mutable. First name from the user's profile.
lastNameString?Mutable. Last name from the user's profile.
emailString?Mutable. Email address.
usernameString?Read-only. Username (cannot be changed via this form).
profilePictureString?URL of the user's profile picture.
isLoadingbooltrue while loading the profile or saving changes.
errorString?Human-readable error. null on success.
save()Future<void>Submits the current field values to updateUserProfile.
ThunderID LogoThunderID Logo

Product

DocsAPIsSDKs
© WSO2 LLC. All rights reserved.Privacy PolicyCookie Policy