How to use cloud_firestore in flutter for web and android?

If you want to use Firebase on Web and Mobile you have to get creative. I created the fb_auth plugin that uses the Mobile SDK firebase_auth on iOS and Android and the firebase package on web. This will give you a single plugin for auth.

https://pub.dev/packages/fb_auth

Im working on firstore and storage but they are not ready yet.

I have also created an article on how to do this with flutter:

https://medium.com/@rody.davis.jr/how-to-build-a-native-cross-platform-project-with-flutter-372b9e4b504f

You have to use dynamic imports so that at compile time it tree shakes what it doesn't need and will not throw an error.

Currently this is the only way to officially use both plugins in the same project.


EDIT: cloud_firestore now added

Two of the FutterFire plugins are now supported for web. FlutterFire plugins supporting web firebase_auth and firebase_core

cloud_firestore is now also supported