Developed with 💙 by Somnio Software
✅ Crashlytics
✅ Analytics
✅ Cloud messaging
✅ Authentication
✅ Firestore
✅ Storage
✅ Remote config
✅ Anonymous
✅ Email & Password
✅ Apple
├── bloc
├── constants
├── mixins
├── models
├── repository
├── screens
├── services
├── utils
├── widgets
├── app.dart
├── main.dart
└── README.md
- bloc: where we handle the current state of the app. The UI layer communicates with components of the bloc layer by dispatching events and listening to changes in the state.
- constants: here we have files related to strings, font weights, and assets.
- mixins: helper classes that we use to abstract some common behavior and reuse it across different places like inside the bloc layer.
- models: here you can find your domain which represents abstractions of the real world.
- repository: the repository layer provides a more object-oriented view of the persistence layer.
- screens: all the screens of the app go here, it is the UI layer.
- services: here you can find abstractions of all the third-party services that we use across the app, like persistence, notifications, etc.
- utils: helper functions that we use across the app.
- widgets: in the widget folder lives purely UI components. We have reusable components as well as widgets that are coupled to a particular screen.
- app: responsible to inflate widgets, initiate process among other stuff.
- main: entry point of the app.
Some configuration steps are required to use this project with Firebase, such as:
- Creating a new project with the Firebase console.
- Adding iOS and Android apps in the Firebase project settings. See this document for the complete instructions.
Crashlytics:
- To test the crash reporting, the app can be forced to crash using the following line:
FirebaseCrashlytics.instance.crash();
the Above line can be put anywhere we want the crash to happen. - Crash reporting happens only when the app has restarted after a crash.
- Go to Crashlytics in the Firebase project.Wait for some time as it can take a few minutes for crashes to appear.
- Flutter package
- Learn more
Analytics:
- To log an event use the get_it service locator instance and get
AnalyticsService
. TheAnalyticsService
is an abstract class that can be extended to add another analytics service. - After configuring Firebase Analytics correctly, it can take some minutes or some hours to show up the events in the Analytics Dashboard of Firebase Console. To track the events nearly in real-time, debug view can be used.
- Flutter package
- Learn more
Cloud messaging
- You can use push notifications and local notifications depending on the 3 possible states your app would be.
FirebaseMessaging.onMessage.listen((event) async {
await _localNotificationService.showNotification();
});
FirebaseMessaging.onMessageOpenedApp.listen(
(event) => _onNotificationChanged(event.data),
);
FirebaseMessaging.onBackgroundMessage(
(message) => _onNotificationChanged(message.data),
);
Authentication:
- Google Sign-In on iOS
- Google Sign-In on Android
- Facebook Login on iOS
- Facebook Login on Android
- Apple Sign-in
Firestore
- Generic implementation of Firestore methods: get, post, put, delete.
- The repository class interacts with the Firestore persistence service.
- Flutter package
- Learn more
Storage
- Methods for uploading and downloading a file from Firebase storage.
Future<void> uploadFile(File file, String storagePath);
Future<String> downloadFile(String storagePath, String localPath);
Future<String> downloadURL(String storagePath);
Remote Config
- Example on how to use Remote Config to communicate to users if the version of an app has increased.
- Flutter package
- Learn more
✅ Internationalization
The configuration is on the yaml file on the root directory.
arb-dir: lib/constants/l10n
template-arb-file: app_en.arb
output-localization-file: app_localizations.dart
You can add new languages each one should have its own file. E.g:
{
“helloWorld”: “Hello World!“,
“@helloWorld”: { “description”: “Somnio Software loves Flutter” },
}
✅ Shared Preferences A providing persistent storage for simple data. ✅ Image Picker You can take pick images from the library or take photos to update you user profile picture. ✅ Onboarding Basic example of an onboarding flow where you can give users a little explanation about the app. ✅ Splash Screen You can easily configure and cusotmize the splash screen in the pubspec.yaml.
flutter_native_splash:
color: “#42A5F5"
image: assets/somnio_logo.png
color_dark: “#042A49”
image_dark: assets/somnio_logo.png
web: false
✅ Flavors We have defined 3 different flavors or development environments:
- Development
- Staging
- Production
Each of these flavors will use a different Firebase project. You can add
google-services.json
(Android) andGoogleService-info.plist
(iOS) for each flavor in following locations:- Android:
android/app/src/dev
android/app/src/staging
android/app/src/prod
- iOS:
ios/config/dev
ios/config/staging
ios/config/prod
- Note: For iOS, XCode might not be able to find the files from the above locations if you simply copy them there. You need to drag and drop or use the Add Files option by right-clicking the folder to make sure that they are added to the Runner target.
- Android:
- You can use each flavor as follows:
- You can run this command in Terminal:
flutter run --flavor FLAVOR_NAME
where FLAVOR_NAME can be replaced with either one ofdev
,staging
, orprod
. - We have also provided the launch configuration for VSCode which you can view from the menu:
Run > Open Configurations
- You can easily switch between different configuratons from the Status bar in VSCode.
- You can run this command in Terminal:
- You can get a current flavor in Flutter by using
getCurrentFlavor()
method from theAppInfo
class. - More on flavors
This project is under construction. Contributions, issues and suggestions are very welcome! Moreover, we want to incorporate these new features:
- Support more sign-in methods like GitHub, Twitter.
- Phone Verification
- Dynamic Links
- Real-time database
- Performance
- Error Management
- Unit, Widget & Integration testing.
- Continuous integration & Continuous Deployment with Firebase App Distribution.