Advanced workflow for users requiring more control.
This is our old guide and your mileage may vary. It is recommended to use the updated Custom Actions workflow.
Before you begin, it’s important that you (or someone on your team) are comfortable with FlutterFlow’s workflow for managing custom code in GitHub as documented here. Using PowerSync with FlutterFlow currently requires dropping down into Dart code and merging code changes using Git.
Skills needed to use this guide:
Used in conjunction with FlutterFlow, PowerSync enables developers to build offline-first apps that are robust in poor network conditions and have highly responsive frontends while relying on Supabase for their backend. This guide provides instructions for configuring PowerSync for use with your FlutterFlow project that has Supabase integration enabled.
This guide takes just over 1 hour to complete. The bulk of that time is spent on the initial FlutterFlow tutorial.
Before you proceed, this guide assumes that you have already signed up for free accounts with both Supabase and PowerSync. If you haven’t signed up for a PowerSync account yet, click here (and if you haven’t signed up for Supabase yet, click here). This guide also assumes that you already have Flutter set up.
This guide assumes you are starting by following FlutterFlow’s tutorial ‘Build a Notes App With FlutterFlow and Supabase’. Some small changes are required to bring this tutorial up to date with the latest Supabase and to make adding PowerSync simpler:
notes
table using the UUID
type for your id
column instead of int
. It’s simpler to work with UUID based primary key columns in PowerSync.This can be found under Dashboard -> Storage -> Policies. This policy is a template provided by Supabase.
4. In Step 10 - Displaying Data in the UI, pass the id
column as a parameter instead of the entire row.
flutter run
at this point.At a high level, the steps required in your Flutter code are as follows:
All of the work in this section will be performed on the develop
branch that you should have set up at this point.
pubspec.yaml
file: powersync: ^0.4.1
logging: ^1.1.1
flutter pub get
and iteratively resolve any dependency issues, for example updating flutter_cache_manager: 3.3.0
to flutter_cache_manager: ^3.3.0
Note: The FlutterFlow team is always updating their platform, so the exact dependencies that you will need to update may differ.
lib/powersync/powersync.dart
and copy the contents of this file:powersyncUrl
on line 12 with the value of your PowerSync Service Instance — you can obtain this by opening your Instance properties and copying the value of “Instance URL”:
lib/main.dart
:
runApp(MyApp())
:Import the following file into your project, it should be located in lib/powersync/models.schema.dart
:
At this point, you can launch your app using flutter run
, and you should see some ‘notes’ rows from your Supabase being printed out on the console! Something like this:
FlutterFlow generates some models in backend/supabase/database/tables
— we complement these by implementing our own offline-first models with static access methods.
Import the following ‘notes’ model into your project:
Generally speaking, you’ll want to replace any Supabase calls in your UI with the newly implemented methods from the appropriate models defined in the previous step.
In this app, we need to update three pages: home_list_page
, note_display_page
, and create_note_page
. It’s recommended to do these one at a time.
Copy the changes from this commit into your notes display page.
This is a big milestone. At this point, force-quit your app, place your test device into airplane mode, and relaunch your app. You should see your notes page being populated — all from your local SQLite database.
Run your app and verify whether you can launch and see your notes list without connectivity (i.e., in offline mode).
Then repeat the steps for the note display and create note pages (link to commit).
For more information, explore the PowerSync docs or join us on our community Discord where our team is always available to answer questions.
Advanced workflow for users requiring more control.
This is our old guide and your mileage may vary. It is recommended to use the updated Custom Actions workflow.
Before you begin, it’s important that you (or someone on your team) are comfortable with FlutterFlow’s workflow for managing custom code in GitHub as documented here. Using PowerSync with FlutterFlow currently requires dropping down into Dart code and merging code changes using Git.
Skills needed to use this guide:
Used in conjunction with FlutterFlow, PowerSync enables developers to build offline-first apps that are robust in poor network conditions and have highly responsive frontends while relying on Supabase for their backend. This guide provides instructions for configuring PowerSync for use with your FlutterFlow project that has Supabase integration enabled.
This guide takes just over 1 hour to complete. The bulk of that time is spent on the initial FlutterFlow tutorial.
Before you proceed, this guide assumes that you have already signed up for free accounts with both Supabase and PowerSync. If you haven’t signed up for a PowerSync account yet, click here (and if you haven’t signed up for Supabase yet, click here). This guide also assumes that you already have Flutter set up.
This guide assumes you are starting by following FlutterFlow’s tutorial ‘Build a Notes App With FlutterFlow and Supabase’. Some small changes are required to bring this tutorial up to date with the latest Supabase and to make adding PowerSync simpler:
notes
table using the UUID
type for your id
column instead of int
. It’s simpler to work with UUID based primary key columns in PowerSync.This can be found under Dashboard -> Storage -> Policies. This policy is a template provided by Supabase.
4. In Step 10 - Displaying Data in the UI, pass the id
column as a parameter instead of the entire row.
flutter run
at this point.At a high level, the steps required in your Flutter code are as follows:
All of the work in this section will be performed on the develop
branch that you should have set up at this point.
pubspec.yaml
file: powersync: ^0.4.1
logging: ^1.1.1
flutter pub get
and iteratively resolve any dependency issues, for example updating flutter_cache_manager: 3.3.0
to flutter_cache_manager: ^3.3.0
Note: The FlutterFlow team is always updating their platform, so the exact dependencies that you will need to update may differ.
lib/powersync/powersync.dart
and copy the contents of this file:powersyncUrl
on line 12 with the value of your PowerSync Service Instance — you can obtain this by opening your Instance properties and copying the value of “Instance URL”:
lib/main.dart
:
runApp(MyApp())
:Import the following file into your project, it should be located in lib/powersync/models.schema.dart
:
At this point, you can launch your app using flutter run
, and you should see some ‘notes’ rows from your Supabase being printed out on the console! Something like this:
FlutterFlow generates some models in backend/supabase/database/tables
— we complement these by implementing our own offline-first models with static access methods.
Import the following ‘notes’ model into your project:
Generally speaking, you’ll want to replace any Supabase calls in your UI with the newly implemented methods from the appropriate models defined in the previous step.
In this app, we need to update three pages: home_list_page
, note_display_page
, and create_note_page
. It’s recommended to do these one at a time.
Copy the changes from this commit into your notes display page.
This is a big milestone. At this point, force-quit your app, place your test device into airplane mode, and relaunch your app. You should see your notes page being populated — all from your local SQLite database.
Run your app and verify whether you can launch and see your notes list without connectivity (i.e., in offline mode).
Then repeat the steps for the note display and create note pages (link to commit).
For more information, explore the PowerSync docs or join us on our community Discord where our team is always available to answer questions.