A Flutter project template with environment configuration and Supabase integration.
The app supports three different environments:
- Development
- Test
- Production
Create the following .env files in the root directory:
.env.development
.env.test
.env.production
Each file should contain:
SUPABASE_URL=your_supabase_url
SUPABASE_ANON_KEY=your_supabase_anon_key
Before running the app, generate the necessary code files:
flutter clean && flutter pub get && dart run build_runner build --delete-conflicting-outputs --verboseDevelopment Environment (Default)
flutter runOr explicitly:
flutter run --dart-define=ENVIRONMENT=developmentTest Environment
flutter run --dart-define=ENVIRONMENT=testProduction Environment
flutter run --dart-define=ENVIRONMENT=productionProduction Build (Android)
flutter build apk --dart-define=ENVIRONMENT=productionProduction Build (iOS)
flutter build ios --dart-define=ENVIRONMENT=production- The app defaults to development environment if no environment is specified
- Environment files (.env.*) are not committed to version control
- Use .env.example as a template for creating environment files
- Make sure to add your environment files to .gitignore
- Clone the repository
- Copy .env.example to create your environment files:
cp .env.example .env.development cp .env.example .env.test cp .env.example .env.production
- Update each .env file with your Supabase credentials
- Run
flutter pub get - Run the app using one of the commands above