Skip to main content

Installation

Add the Supabase Flutter package to your pubspec.yaml:
Then run:

Initializing

Initialize Supabase in your app’s main function.
String
required
The unique Supabase URL for your project.
String
required
The Supabase anon key for your project.
AuthClientOptions
Authentication configuration options.

Database Operations

Select Data

Query data from your tables.
List<Map<String, dynamic>>
The returned rows from the query.

Select with Filters

Select with Joins

Common Filters

Insert Data

Insert rows into your tables.
Map | List<Map>
required
The values to insert. Can be a single map or a list of maps.

Insert Multiple Rows

Update Data

Update existing rows in your tables.
Map<String, dynamic>
required
The values to update.

Upsert Data

Insert or update rows based on unique constraints.

Delete Data

Delete rows from your tables.

Authentication

Sign Up

Create a new user account.
String
required
The user’s email address.
String
required
The user’s password.
Map<String, dynamic>
Additional user metadata.
String
A URL to redirect to after signup.
AuthResponse

Sign In

Sign in an existing user.

Sign Out

Sign out the current user.

Get Session

Get the current session.
Session?
The current session object or null if no active session.

Get User

Get the current user.
User?
The current user object or null if not authenticated.

Auth State Changes

Listen to authentication state changes.

Storage

Upload File

Upload a file to a storage bucket.
String
required
The file path including the file name.
File | Uint8List
required
The file data to upload.
FileOptions
Upload options.

Download File

Download a file from storage.
String
required
The file path to download.
Uint8List
The file data as bytes.

List Files

List all files in a bucket.

Delete Files

Delete files from storage.

Get Public URL

Get the public URL for a file.

Realtime

Subscribe to Changes

Listen to database changes in realtime.
PostgresChangeEvent
required
The database event to listen for: insert, update, delete, or all.
String
required
The database schema to listen to.
String
required
The table to listen to.
void Function(dynamic)
required
Function to call when an event occurs.

Unsubscribe

Stop listening to changes.

Edge Functions

Invoke Function

Invoke a Supabase Edge Function.
String
required
The name of the Edge Function to invoke.
Map<String, dynamic>
The request body to send to the function.
Map<String, String>
Custom headers to send with the request.
HttpMethod
default:"HttpMethod.post"
HTTP method to use.
FunctionResponse

Error Handling

Handle errors using try-catch blocks:
Handle deep links for OAuth and password recovery:

Additional Resources

GitHub Repository

View the source code and contribute

pub.dev Package

View package details and versions