A template for flutter app development with best practices and features.
git clone https://github.com/firebase/flutterfire.git
flutter pub get
By editing the dart_defines/dev.json
and dart_defines/prod.json
files, you can define the environment variables for the app.
{
"flavor": "dev",
"appName": "tomoyanakano - dev",
"appIdSuffix": ".dev",
"iOSBundleIdentifier": "com.tomoyanakano.dev",
"androidBundleIdentifier": "com.tomoyanakano.dev",
"LaunchStoryboardName": "LaunchScreenDev"
}
Using flutter_launcher_icons package, you can generate app icons for both iOS and Android.
By editing the flutter_launcher_icons-dev.yaml
and flutter_launcher_icons-prod.yaml
files, you can define the app icon settings.
For more details, see the documentation.
flutter_icons:
android: true
ios: true
image_path: "assets/launcher_icon/dev.png" // icon image path
Run the following command to generate app icons.
flutter pub run flutter_launcher_icons:main
Using flutter_native_splash package, you can generate launch storyboard for iOS.
By editing the flutter_native_splash-dev.yaml
and flutter_native_splash-prod.yaml
files, you can define the launch storyboard settings.
For more details, see the documentation.
flutter_native_splash:
color: "#ffffff"
image: assets/launcher_icon/dev.png // launch storyboard image path
android_12:
image: assets/launcher_icon/dev.png // launch storyboard image path
icon_background_color: "#ffffff" // icon background color
Run the following command to generate launch storyboard.
flutter pub run flutter_native_splash:create --flavors dev,prod
This template uses Firebase for backend services. To integrate Firebase with the app, follow the steps below.
- Create a new project on Firebase Console.
- Add iOS and Android apps to the project.
- Download
GoogleService-Info.plist
from Firebase Console. - Place the file in the
ios/dev
orios/prod
directory.
- Download
google-services.json
from Firebase Console. - Place the file in the
android/app/src/dev
orandroid/app/src/prod
directory.
flutter run --dart-define-from-file=dart_defines/dev.json // Develpment environment
flutter run --dart-define-from-file=dart_defines/prod.json // Prod environment
This template follows the Clean Architecture pattern for organizing the codebase by using Riverpod.
graph TD;
subgraph Presentation
Widgets
States
end
subgraph UseCase
Notifier
Provider
end
subgraph Application
Service
end
subgraph Domain
Model
end
subgraph Data
Repository
DataSource
end
Presentation -->|query| Provider
Presentation -->|mutate| Notifier
Provider --> Application
Notifier --> Application
Application --> Domain
Domain --> Data
Repository --> DataSource
This Template follows Feature First Structure(Folders-by-Feature) for organizing the codebase.
For example, the lib
directory is structured as follows:
lib
βββ src
β βββ features
β β βββ feature1
β β β βββ data
β β β βββ domain
β β β βββ presentation
β β β βββ providers
β β β feature2
β β β βββ data
β β β βββ domain
β β β βββ presentation
β β β βββ providers
β βββ common_widgets
β βββ constants
β βββ extensions
β βββ router
β βββ utilities
Refer to the Flutter Project Structure / Code with Andrea.
- Authentication
- Maintenance Mode
- Force Update
- Notification
- Settings
Feel free to contribute to this project. Any contributions you make are greatly appreciated.
This project is licensed under the MIT License - see the LICENSE file for details.