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 goes 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.
To use this project with Firebase, some configuration steps are required.
- Create a new project with the Firebase console.
- Add iOS and Android apps in the Firebase project settings.
See this document for full instructions.
Crashlytics:
- To test the crash reporting, the app be can forced crash using following line:
FirebaseCrashlytics.instance.crash();
Above line can be put anywhere where we want the crash to happen. - Crash reporting happens only when the app is restarted after a crash.
- Go to Crashlytics in the Firebase project. Wait for sometime as it can take a few minutes for crashes to appear.
- Flutter package
- Learn more
Analytics:
- To log an event use get_it service locator instance and get
AnalyticsService
. TheAnalyticsService
is an abstract class which 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 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.
- Repository class interact with firestore persistence service
- Flutter package
- Learn more
Storage
- Methods for upload and download 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 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 explain users a little explanation about the app.
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 differents flavors or development enviroments:
- Development
- Staging
- Production
Each of these flavor 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 above locations if you simply copy it there. You need to drag and drop or use Add Files option by right clicking the folder to make sure that they are added to 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 current flavor in Flutter by using
getCurrentFlavor()
method fromAppInfo
class. - More on flavors
This project is under construction. Contributions, issues and suggestions are very welcome! Moreover, we want to incorporate this new features:
- Support more sign in methods like GitHub, Twitter.
- Phone Verification
- Dynamic Links
- Real time database
- Performance
- Error Management
- Unit, Widget & Integration testing.
- Continous integration & Continous Deployment with Firebase App Distribution.