Getting Started

Build a User Management App with Flutter

This tutorial demonstrates how to build a basic user management app. The app authenticates and identifies the user, stores their profile information in the database, and allows the user to log in, update their profile details, and upload a profile photo. The app uses:

  • Supabase Database - a Postgres database for storing your user data and Row Level Security so data is protected and users can only access their own information.
  • Supabase Auth - users log in through magic links sent to their email (without having to set up passwords).
  • Supabase Storage - users can upload a profile photo.

Supabase User Management example

Project setup

Before we start building we're going to set up our Database and API. This is as simple as starting a new Project in Supabase and then creating a "schema" inside the database.

Create a project

  1. Create a new project in the Supabase Dashboard.
  2. Enter your project details.
  3. Wait for the new database to launch.

Set up the database schema

Now we are going to set up the database schema. We can use the "User Management Starter" quickstart in the SQL Editor, or you can just copy/paste the SQL from below and run it yourself.

  1. Go to the SQL Editor page in the Dashboard.
  2. Click User Management Starter.
  3. Click Run.

_10
supabase link --project-ref <project-id>
_10
# You can get <project-id> from your project's dashboard URL: https://supabase.com/dashboard/project/<project-id>
_10
supabase db pull

Get the API Keys

Now that you've created some database tables, you are ready to insert data using the auto-generated API. We just need to get the Project URL and anon key from the API settings.

  1. Go to the API Settings page in the Dashboard.
  2. Find your Project URL, anon, and service_role keys on this page.

Building the app

Let's start building the Flutter app from scratch.

Initialize a Flutter app

We can use flutter create to initialize an app called supabase_quickstart:


_10
flutter create supabase_quickstart

Then let's install the only additional dependency: supabase_flutter

Copy and paste the following line in your pubspec.yaml to install the package:


_10
supabase_flutter: ^2.0.0

Run flutter pub get to install the dependencies.

Now that we have the dependencies installed let's setup deep links. Setting up deep links is required to bring back the user to the app when they click on the magic link to sign in. We can setup deep links with just a minor tweak on our Flutter application.

We have to use io.supabase.flutterquickstart as the scheme. In this example, we will use login-callback as the host for our deep link, but you can change it to whatever you would like.

First, add io.supabase.flutterquickstart://login-callback/ as a new redirect URL in the Dashboard.

Supabase console deep link setting

That is it on Supabase's end and the rest are platform specific settings:

Edit the ios/Runner/Info.plist file.

Add CFBundleURLTypes to enable deep linking:

ios/Runner/Info.plist"

_20
<!-- ... other tags -->
_20
<plist>
_20
<dict>
_20
<!-- ... other tags -->
_20
_20
<!-- Add this array for Deep Links -->
_20
<key>CFBundleURLTypes</key>
_20
<array>
_20
<dict>
_20
<key>CFBundleTypeRole</key>
_20
<string>Editor</string>
_20
<key>CFBundleURLSchemes</key>
_20
<array>
_20
<string>io.supabase.flutterquickstart</string>
_20
</array>
_20
</dict>
_20
</array>
_20
<!-- ... other tags -->
_20
</dict>
_20
</plist>

Main function

Now that we have deep links ready let's initialize the Supabase client inside our main function with the API credentials that you copied earlier. These variables will be exposed on the app, and that's completely fine since we have Row Level Security enabled on our Database.

lib/main.dart

_21
import 'package:flutter/material.dart';
_21
import 'package:supabase_flutter/supabase_flutter.dart';
_21
_21
Future<void> main() async {
_21
await Supabase.initialize(
_21
url: 'YOUR_SUPABASE_URL',
_21
anonKey: 'YOUR_SUPABASE_ANON_KEY',
_21
);
_21
runApp(const MyApp());
_21
}
_21
_21
final supabase = Supabase.instance.client;
_21
_21
class MyApp extends StatelessWidget {
_21
const MyApp({super.key});
_21
_21
@override
_21
Widget build(BuildContext context) {
_21
return const MaterialApp(title: 'Supabase Flutter');
_21
}
_21
}

Set up splash screen

Let's create a splash screen that will be shown to users right after they open the app. This screen retrieves the current session and redirects the user accordingly.

lib/pages/splash_page.dart

_38
import 'package:flutter/material.dart';
_38
import 'package:supabase_quickstart/main.dart';
_38
_38
class SplashPage extends StatefulWidget {
_38
const SplashPage({super.key});
_38
_38
@override
_38
State<SplashPage> createState() => _SplashPageState();
_38
}
_38
_38
class _SplashPageState extends State<SplashPage> {
_38
@override
_38
void initState() {
_38
super.initState();
_38
_redirect();
_38
}
_38
_38
Future<void> _redirect() async {
_38
await Future.delayed(Duration.zero);
_38
if (!mounted) {
_38
return;
_38
}
_38
_38
final session = supabase.auth.currentSession;
_38
if (session != null) {
_38
Navigator.of(context).pushReplacementNamed('/account');
_38
} else {
_38
Navigator.of(context).pushReplacementNamed('/login');
_38
}
_38
}
_38
_38
@override
_38
Widget build(BuildContext context) {
_38
return const Scaffold(
_38
body: Center(child: CircularProgressIndicator()),
_38
);
_38
}
_38
}

Set up a login page

Let's create a Flutter widget to manage logins and sign ups. We'll use Magic Links, so users can sign in with their email without using passwords. Notice that this page sets up a listener on the user's auth state using onAuthStateChange. A new event will fire when the user comes back to the app by clicking their magic link, which this page can catch and redirect the user accordingly.

lib/pages/login_page.dart

_102
import 'dart:async';
_102
_102
import 'package:flutter/foundation.dart';
_102
import 'package:flutter/material.dart';
_102
import 'package:supabase_flutter/supabase_flutter.dart';
_102
import 'package:supabase_quickstart/main.dart';
_102
_102
class LoginPage extends StatefulWidget {
_102
const LoginPage({super.key});
_102
_102
@override
_102
State<LoginPage> createState() => _LoginPageState();
_102
}
_102
_102
class _LoginPageState extends State<LoginPage> {
_102
bool _isLoading = false;
_102
bool _redirecting = false;
_102
late final TextEditingController _emailController = TextEditingController();
_102
late final StreamSubscription<AuthState> _authStateSubscription;
_102
_102
Future<void> _signIn() async {
_102
try {
_102
setState(() {
_102
_isLoading = true;
_102
});
_102
await supabase.auth.signInWithOtp(
_102
email: _emailController.text.trim(),
_102
emailRedirectTo:
_102
kIsWeb ? null : 'io.supabase.flutterquickstart://login-callback/',
_102
);
_102
if (mounted) {
_102
ScaffoldMessenger.of(context).showSnackBar(
_102
const SnackBar(content: Text('Check your email for a login link!')),
_102
);
_102
_emailController.clear();
_102
}
_102
} on AuthException catch (error) {
_102
if (mounted) {
_102
SnackBar(
_102
content: Text(error.message),
_102
backgroundColor: Theme.of(context).colorScheme.error,
_102
);
_102
}
_102
} catch (error) {
_102
if (mounted) {
_102
SnackBar(
_102
content: const Text('Unexpected error occurred'),
_102
backgroundColor: Theme.of(context).colorScheme.error,
_102
);
_102
}
_102
} finally {
_102
if (mounted) {
_102
setState(() {
_102
_isLoading = false;
_102
});
_102
}
_102
}
_102
}
_102
_102
@override
_102
void initState() {
_102
_authStateSubscription = supabase.auth.onAuthStateChange.listen((data) {
_102
if (_redirecting) return;
_102
final session = data.session;
_102
if (session != null) {
_102
_redirecting = true;
_102
Navigator.of(context).pushReplacementNamed('/account');
_102
}
_102
});
_102
super.initState();
_102
}
_102
_102
@override
_102
void dispose() {
_102
_emailController.dispose();
_102
_authStateSubscription.cancel();
_102
super.dispose();
_102
}
_102
_102
@override
_102
Widget build(BuildContext context) {
_102
return Scaffold(
_102
appBar: AppBar(title: const Text('Sign In')),
_102
body: ListView(
_102
padding: const EdgeInsets.symmetric(vertical: 18, horizontal: 12),
_102
children: [
_102
const Text('Sign in via the magic link with your email below'),
_102
const SizedBox(height: 18),
_102
TextFormField(
_102
controller: _emailController,
_102
decoration: const InputDecoration(labelText: 'Email'),
_102
),
_102
const SizedBox(height: 18),
_102
ElevatedButton(
_102
onPressed: _isLoading ? null : _signIn,
_102
child: Text(_isLoading ? 'Loading' : 'Send Magic Link'),
_102
),
_102
],
_102
),
_102
);
_102
}
_102
}

Set up account page

After a user is signed in we can allow them to edit their profile details and manage their account. Let's create a new widget called account_page.dart for that.

lib/pages/account_page.dart"

_163
import 'package:flutter/material.dart';
_163
import 'package:supabase_flutter/supabase_flutter.dart';
_163
import 'package:supabase_quickstart/main.dart';
_163
_163
class AccountPage extends StatefulWidget {
_163
const AccountPage({super.key});
_163
_163
@override
_163
State<AccountPage> createState() => _AccountPageState();
_163
}
_163
_163
class _AccountPageState extends State<AccountPage> {
_163
final _usernameController = TextEditingController();
_163
final _websiteController = TextEditingController();
_163
_163
var _loading = true;
_163
_163
/// Called once a user id is received within `onAuthenticated()`
_163
Future<void> _getProfile() async {
_163
setState(() {
_163
_loading = true;
_163
});
_163
_163
try {
_163
final userId = supabase.auth.currentUser!.id;
_163
final data =
_163
await supabase.from('profiles').select().eq('id', userId).single();
_163
_usernameController.text = (data['username'] ?? '') as String;
_163
_websiteController.text = (data['website'] ?? '') as String;
_163
} on PostgrestException catch (error) {
_163
if (mounted) {
_163
SnackBar(
_163
content: Text(error.message),
_163
backgroundColor: Theme.of(context).colorScheme.error,
_163
);
_163
}
_163
} catch (error) {
_163
if (mounted) {
_163
SnackBar(
_163
content: const Text('Unexpected error occurred'),
_163
backgroundColor: Theme.of(context).colorScheme.error,
_163
);
_163
}
_163
} finally {
_163
if (mounted) {
_163
setState(() {
_163
_loading = false;
_163
});
_163
}
_163
}
_163
}
_163
_163
/// Called when user taps `Update` button
_163
Future<void> _updateProfile() async {
_163
setState(() {
_163
_loading = true;
_163
});
_163
final userName = _usernameController.text.trim();
_163
final website = _websiteController.text.trim();
_163
final user = supabase.auth.currentUser;
_163
final updates = {
_163
'id': user!.id,
_163
'username': userName,
_163
'website': website,
_163
'updated_at': DateTime.now().toIso8601String(),
_163
};
_163
try {
_163
await supabase.from('profiles').upsert(updates);
_163
if (mounted) {
_163
const SnackBar(
_163
content: Text('Successfully updated profile!'),
_163
);
_163
}
_163
} on PostgrestException catch (error) {
_163
if (mounted) {
_163
SnackBar(
_163
content: Text(error.message),
_163
backgroundColor: Theme.of(context).colorScheme.error,
_163
);
_163
}
_163
} catch (error) {
_163
if (mounted) {
_163
SnackBar(
_163
content: const Text('Unexpected error occurred'),
_163
backgroundColor: Theme.of(context).colorScheme.error,
_163
);
_163
}
_163
} finally {
_163
if (mounted) {
_163
setState(() {
_163
_loading = false;
_163
});
_163
}
_163
}
_163
}
_163
_163
Future<void> _signOut() async {
_163
try {
_163
await supabase.auth.signOut();
_163
} on AuthException catch (error) {
_163
if (mounted) {
_163
SnackBar(
_163
content: Text(error.message),
_163
backgroundColor: Theme.of(context).colorScheme.error,
_163
);
_163
}
_163
} catch (error) {
_163
if (mounted) {
_163
SnackBar(
_163
content: const Text('Unexpected error occurred'),
_163
backgroundColor: Theme.of(context).colorScheme.error,
_163
);
_163
}
_163
} finally {
_163
if (mounted) {
_163
Navigator.of(context).pushReplacementNamed('/login');
_163
}
_163
}
_163
}
_163
_163
@override
_163
void initState() {
_163
super.initState();
_163
_getProfile();
_163
}
_163
_163
@override
_163
void dispose() {
_163
_usernameController.dispose();
_163
_websiteController.dispose();
_163
super.dispose();
_163
}
_163
_163
@override
_163
Widget build(BuildContext context) {
_163
return Scaffold(
_163
appBar: AppBar(title: const Text('Profile')),
_163
body: _loading
_163
? const Center(child: CircularProgressIndicator())
_163
: ListView(
_163
padding: const EdgeInsets.symmetric(vertical: 18, horizontal: 12),
_163
children: [
_163
TextFormField(
_163
controller: _usernameController,
_163
decoration: const InputDecoration(labelText: 'User Name'),
_163
),
_163
const SizedBox(height: 18),
_163
TextFormField(
_163
controller: _websiteController,
_163
decoration: const InputDecoration(labelText: 'Website'),
_163
),
_163
const SizedBox(height: 18),
_163
ElevatedButton(
_163
onPressed: _loading ? null : _updateProfile,
_163
child: Text(_loading ? 'Saving...' : 'Update'),
_163
),
_163
const SizedBox(height: 18),
_163
TextButton(onPressed: _signOut, child: const Text('Sign Out')),
_163
],
_163
),
_163
);
_163
}
_163
}

Launch!

Now that we have all the components in place, let's update lib/main.dart:

lib/main.dart

_46
import 'package:flutter/material.dart';
_46
import 'package:supabase_flutter/supabase_flutter.dart';
_46
import 'package:supabase_quickstart/pages/account_page.dart';
_46
import 'package:supabase_quickstart/pages/login_page.dart';
_46
import 'package:supabase_quickstart/pages/splash_page.dart';
_46
_46
Future<void> main() async {
_46
await Supabase.initialize(
_46
url: 'YOUR_SUPABASE_URL',
_46
anonKey: 'YOUR_SUPABASE_ANON_KEY',
_46
);
_46
runApp(const MyApp());
_46
}
_46
_46
final supabase = Supabase.instance.client;
_46
_46
class MyApp extends StatelessWidget {
_46
const MyApp({super.key});
_46
_46
@override
_46
Widget build(BuildContext context) {
_46
return MaterialApp(
_46
title: 'Supabase Flutter',
_46
theme: ThemeData.dark().copyWith(
_46
primaryColor: Colors.green,
_46
textButtonTheme: TextButtonThemeData(
_46
style: TextButton.styleFrom(
_46
foregroundColor: Colors.green,
_46
),
_46
),
_46
elevatedButtonTheme: ElevatedButtonThemeData(
_46
style: ElevatedButton.styleFrom(
_46
foregroundColor: Colors.white,
_46
backgroundColor: Colors.green,
_46
),
_46
),
_46
),
_46
initialRoute: '/',
_46
routes: <String, WidgetBuilder>{
_46
'/': (_) => const SplashPage(),
_46
'/login': (_) => const LoginPage(),
_46
'/account': (_) => const AccountPage(),
_46
},
_46
);
_46
}
_46
}

Once that's done, run this in a terminal window to launch on Android or iOS:


_10
flutter run

Or for web, run the following command to launch it on localhost:3000


_10
flutter run -d web-server --web-hostname localhost --web-port 3000

And then open the browser to localhost:3000 and you should see the completed app.

Supabase User Management example

Bonus: Profile photos

Every Supabase project is configured with Storage for managing large files like photos and videos.

Making sure we have a public bucket

We will be storing the image as a publicly sharable image. Make sure your avatars bucket is set to public, and if it is not, change the publicity by clicking the dot menu that appears when you hover over the bucket name. You should see an orange Public badge next to your bucket name if your bucket is set to public.

Adding image uploading feature to account page

We will use image_picker plugin to select an image from the device.

Add the following line in your pubspec.yaml file to install image_picker:


_10
image_picker: ^1.0.5

Using image_picker requires some additional preparation depending on the platform. Follow the instruction on README.md of image_picker on how to set it up for the platform you are using.

Once you are done with all of the above, it is time to dive into coding.

Create an upload widget

Let's create an avatar for the user so that they can upload a profile photo. We can start by creating a new component:

lib/components/avatar.dart

_99
import 'package:flutter/material.dart';
_99
import 'package:image_picker/image_picker.dart';
_99
import 'package:supabase_flutter/supabase_flutter.dart';
_99
import 'package:supabase_quickstart/main.dart';
_99
_99
class Avatar extends StatefulWidget {
_99
const Avatar({
_99
super.key,
_99
required this.imageUrl,
_99
required this.onUpload,
_99
});
_99
_99
final String? imageUrl;
_99
final void Function(String) onUpload;
_99
_99
@override
_99
State<Avatar> createState() => _AvatarState();
_99
}
_99
_99
class _AvatarState extends State<Avatar> {
_99
bool _isLoading = false;
_99
_99
@override
_99
Widget build(BuildContext context) {
_99
return Column(
_99
children: [
_99
if (widget.imageUrl == null || widget.imageUrl!.isEmpty)
_99
Container(
_99
width: 150,
_99
height: 150,
_99
color: Colors.grey,
_99
child: const Center(
_99
child: Text('No Image'),
_99
),
_99
)
_99
else
_99
Image.network(
_99
widget.imageUrl!,
_99
width: 150,
_99
height: 150,
_99
fit: BoxFit.cover,
_99
),
_99
ElevatedButton(
_99
onPressed: _isLoading ? null : _upload,
_99
child: const Text('Upload'),
_99
),
_99
],
_99
);
_99
}
_99
_99
Future<void> _upload() async {
_99
final picker = ImagePicker();
_99
final imageFile = await picker.pickImage(
_99
source: ImageSource.gallery,
_99
maxWidth: 300,
_99
maxHeight: 300,
_99
);
_99
if (imageFile == null) {
_99
return;
_99
}
_99
setState(() => _isLoading = true);
_99
_99
try {
_99
final bytes = await imageFile.readAsBytes();
_99
final fileExt = imageFile.path.split('.').last;
_99
final fileName = '${DateTime.now().toIso8601String()}.$fileExt';
_99
final filePath = fileName;
_99
await supabase.storage.from('avatars').uploadBinary(
_99
filePath,
_99
bytes,
_99
fileOptions: FileOptions(contentType: imageFile.mimeType),
_99
);
_99
final imageUrlResponse = await supabase.storage
_99
.from('avatars')
_99
.createSignedUrl(filePath, 60 * 60 * 24 * 365 * 10);
_99
widget.onUpload(imageUrlResponse);
_99
} on StorageException catch (error) {
_99
if (mounted) {
_99
ScaffoldMessenger.of(context).showSnackBar(
_99
SnackBar(
_99
content: Text(error.message),
_99
backgroundColor: Theme.of(context).colorScheme.error,
_99
),
_99
);
_99
}
_99
} catch (error) {
_99
if (mounted) {
_99
ScaffoldMessenger.of(context).showSnackBar(
_99
SnackBar(
_99
content: const Text('Unexpected error occurred'),
_99
backgroundColor: Theme.of(context).colorScheme.error,
_99
),
_99
);
_99
}
_99
}
_99
_99
setState(() => _isLoading = false);
_99
}
_99
}

Add the new widget

And then we can add the widget to the Account page as well as some logic to update the avatar_url whenever the user uploads a new avatar.

lib/pages/account_page.dart

_211
import 'package:flutter/material.dart';
_211
import 'package:supabase_flutter/supabase_flutter.dart';
_211
import 'package:supabase_quickstart/components/avatar.dart';
_211
import 'package:supabase_quickstart/main.dart';
_211
_211
class AccountPage extends StatefulWidget {
_211
const AccountPage({super.key});
_211
_211
@override
_211
State<AccountPage> createState() => _AccountPageState();
_211
}
_211
_211
class _AccountPageState extends State<AccountPage> {
_211
final _usernameController = TextEditingController();
_211
final _websiteController = TextEditingController();
_211
_211
String? _avatarUrl;
_211
var _loading = true;
_211
_211
/// Called once a user id is received within `onAuthenticated()`
_211
Future<void> _getProfile() async {
_211
setState(() {
_211
_loading = true;
_211
});
_211
_211
try {
_211
final userId = supabase.auth.currentSession!.user.id;
_211
final data = await supabase
_211
.from('profiles')
_211
.select()
_211
.eq('id', userId)
_211
.single();
_211
_usernameController.text = (data['username'] ?? '') as String;
_211
_websiteController.text = (data['website'] ?? '') as String;
_211
_avatarUrl = (data['avatar_url'] ?? '') as String;
_211
} on PostgrestException catch (error) {
_211
if (mounted) {
_211
SnackBar(
_211
content: Text(error.message),
_211
backgroundColor: Theme.of(context).colorScheme.error,
_211
);
_211
}
_211
} catch (error) {
_211
if (mounted) {
_211
SnackBar(
_211
content: const Text('Unexpected error occurred'),
_211
backgroundColor: Theme.of(context).colorScheme.error,
_211
);
_211
}
_211
} finally {
_211
if (mounted) {
_211
setState(() {
_211
_loading = false;
_211
});
_211
}
_211
}
_211
}
_211
_211
/// Called when user taps `Update` button
_211
Future<void> _updateProfile() async {
_211
setState(() {
_211
_loading = true;
_211
});
_211
final userName = _usernameController.text.trim();
_211
final website = _websiteController.text.trim();
_211
final user = supabase.auth.currentUser;
_211
final updates = {
_211
'id': user!.id,
_211
'username': userName,
_211
'website': website,
_211
'updated_at': DateTime.now().toIso8601String(),
_211
};
_211
try {
_211
await supabase.from('profiles').upsert(updates);
_211
if (mounted) {
_211
const SnackBar(
_211
content: Text('Successfully updated profile!'),
_211
);
_211
}
_211
} on PostgrestException catch (error) {
_211
if (mounted) {
_211
SnackBar(
_211
content: Text(error.message),
_211
backgroundColor: Theme.of(context).colorScheme.error,
_211
);
_211
}
_211
} catch (error) {
_211
if (mounted) {
_211
SnackBar(
_211
content: const Text('Unexpected error occurred'),
_211
backgroundColor: Theme.of(context).colorScheme.error,
_211
);
_211
}
_211
} finally {
_211
if (mounted) {
_211
setState(() {
_211
_loading = false;
_211
});
_211
}
_211
}
_211
}
_211
_211
Future<void> _signOut() async {
_211
try {
_211
await supabase.auth.signOut();
_211
} on AuthException catch (error) {
_211
if (mounted) {
_211
SnackBar(
_211
content: Text(error.message),
_211
backgroundColor: Theme.of(context).colorScheme.error,
_211
);
_211
}
_211
} catch (error) {
_211
if (mounted) {
_211
SnackBar(
_211
content: const Text('Unexpected error occurred'),
_211
backgroundColor: Theme.of(context).colorScheme.error,
_211
);
_211
}
_211
} finally {
_211
if (mounted) {
_211
Navigator.of(context).pushReplacementNamed('/login');
_211
}
_211
}
_211
}
_211
_211
/// Called when image has been uploaded to Supabase storage from within Avatar widget
_211
Future<void> _onUpload(String imageUrl) async {
_211
try {
_211
final userId = supabase.auth.currentUser!.id;
_211
await supabase.from('profiles').upsert({
_211
'id': userId,
_211
'avatar_url': imageUrl,
_211
});
_211
if (mounted) {
_211
const SnackBar(
_211
content: Text('Updated your profile image!'),
_211
);
_211
}
_211
} on PostgrestException catch (error) {
_211
if (mounted) {
_211
SnackBar(
_211
content: Text(error.message),
_211
backgroundColor: Theme.of(context).colorScheme.error,
_211
);
_211
}
_211
} catch (error) {
_211
if (mounted) {
_211
SnackBar(
_211
content: const Text('Unexpected error occurred'),
_211
backgroundColor: Theme.of(context).colorScheme.error,
_211
);
_211
}
_211
}
_211
if (!mounted) {
_211
return;
_211
}
_211
_211
setState(() {
_211
_avatarUrl = imageUrl;
_211
});
_211
}
_211
_211
@override
_211
void initState() {
_211
super.initState();
_211
_getProfile();
_211
}
_211
_211
@override
_211
void dispose() {
_211
_usernameController.dispose();
_211
_websiteController.dispose();
_211
super.dispose();
_211
}
_211
_211
@override
_211
Widget build(BuildContext context) {
_211
return Scaffold(
_211
appBar: AppBar(title: const Text('Profile')),
_211
body: _loading
_211
? const Center(child: CircularProgressIndicator())
_211
: ListView(
_211
padding: const EdgeInsets.symmetric(vertical: 18, horizontal: 12),
_211
children: [
_211
Avatar(
_211
imageUrl: _avatarUrl,
_211
onUpload: _onUpload,
_211
),
_211
const SizedBox(height: 18),
_211
TextFormField(
_211
controller: _usernameController,
_211
decoration: const InputDecoration(labelText: 'User Name'),
_211
),
_211
const SizedBox(height: 18),
_211
TextFormField(
_211
controller: _websiteController,
_211
decoration: const InputDecoration(labelText: 'Website'),
_211
),
_211
const SizedBox(height: 18),
_211
ElevatedButton(
_211
onPressed: _loading ? null : _updateProfile,
_211
child: Text(_loading ? 'Saving...' : 'Update'),
_211
),
_211
const SizedBox(height: 18),
_211
TextButton(onPressed: _signOut, child: const Text('Sign Out')),
_211
],
_211
),
_211
);
_211
}
_211
}

Congratulations, you've built a fully functional user management app using Flutter and Supabase!

See also