This app is a complete setup for a production ready Flutter application using Supabase for authentication, database, storage, and more.
Make sure you installed Flutter and Dart in your machine
- Clone or fork the repository
git clone https://github.com/SandroMaglione/flutter-supabase-template.git
- Install the packages required
flutter pub get
- Run the build command (
build_runner
)
flutter packages pub run build_runner build
- Update
.vscode/launch.json
args
with your Supabase project URL (SUPABASE_URL
) and Key (SUPABASE_ANNON_KEY
):
{
"version": "0.2.0",
"configurations": [
{
"name": "Production",
"request": "launch",
"type": "dart",
"program": "lib/main_prod.dart",
"args": [
"--dart-define=SUPABASE_URL=Url",
"--dart-define=SUPABASE_ANNON_KEY=Key"
]
}
]
}
- Run the app 🚀
The project is organized in releases, each containing a specific set of changes for one feature:
- Environment variables
- Routing (
auto_route
) - Dependency injection (
injectable
) - Supabase authentication
- Supabase database
- Functional programming (
fpdart
)
You can review each set of changes individually by looking at each release.
Note: Each feature is build on top of the previous one.
📃 Packages used (pubspec.yaml)
- supabase_flutter: Supabase SDK for Flutter's applications
- auto_route: Routing and navigation using auto-generation
- injectable (get_it): Dependency injection using auto-generation
- fpdart: Functional programming in dart and flutter
Note: This setup is opinionated. There are many other possible solutions and packages to achieve the same (or better) result. It would be interesting to start a discussion about each solution (by opening new PRs implementing other options)
Each feature in the app has a blog post associated with it that explains more in the details the changes made:
- Environment variables
- Routing (
auto_route
) - Dependency injection (
injectable
) - Supabase authentication
- Supabase database
- Functional programming (
fpdart
)
- Adding support for Supabase database
- Improving the code using fpdart (Functional Programming)
- Adding support for Supabase storage
Every feedback, feature request, and contribution is gladly accepted:
- Create a new issue request
- Create a new PR for contributions