In this small blog post You could find the files that need to be changed to get clean rx_bloc_cli project from Firebase Dependencies. This is follow-up from a previous blog post to get it running on web.
JavaSscript
- firebase-messaging-sw.js
- remove firebase_web_config.js
- related js code from index.html
Dart Dependencies
Remove firebase dependencies from pubspec.yaml and Build Runner – Build. This sill put your project on fire/red/ so you will know where to touch. You may need to reopen the IDE if it doesn’t update the cache.
Changes in Dart Files
- app_setup.dart
- firebase_messaging_callbacks.dart
- firebase_options.dart
- family_tree.dart
- analytics_repository.dart
- push_notification_repository
- analytics_interceptor.dart
- family_tree_with_dependencies.dart – this file probably better be last – as some of the clean-up may change the amount of dependency injection parameters to classes.
In long term this clean-up is not good solution, because will need some implementation for the Cloud Features in any meaningful app. The features are:
- Analytics – What the user visits /when/how much time
- Crashlitics – Any Issue may be logged, troubleshooted and resolved in very close to real time i if you have the appropiate info.
- Push Notifications Messaging – Push Notification is one of the Social Features to increase user engagement.
- Deep Linking / Dynamic Links
Better approach will be:
- Create internal Models/Data Transfer Object – for every object that is imported from firebase
- Create functional interfaces that accept these DTOs, but that are identical to the needed by firebase.
- Create Firebase Specific Implementation
This way I/ you will be able to swap the cloud provider to different one – just by:
- implementing the interface
- mapping parameters to the different providers
- replacing in the Depencency Injection – the implementation of the interfaces.