Reputation: 1706
I'm working on a Flutter app, compiled in both web AND mobile version. Everything worked like a charm until I decided to use Firebase.
I found that there are many libs that allow to use Firebase in Flutter, for mobile apps. I also found a lib that allows to use Firebase in Flutter web app.
The problem is: Firebase plugin for web version is using "dart:html"
, which isn't supported for mobile versions of Flutter apps. On the other side, mobile libs aren't supported by web versions and I always get a PlatformException
when using them in web app.
So here is my question: Does anyone know a Flutter's Firebase lib, that works on BOTH mobile AND web versions, so that I only have to compile in the platform I want, without having to change the code before?
EDIT: I know there is a way to write specific code for Android or iOS version, but I can't find any clue for writing specific code for the web version. This should be another way to solve the problem...
Any idea?
Upvotes: 0
Views: 914
Reputation: 80
What firebase plugins are you using?? As there are only limited firebase plugins avalaible to use on web which includes firebase_analytics
firebase_auth
cloud_firestore
cloud_functions
firebase_messaging
firebase_storage
firebase_core
if you are using any firebase plugin other than these then they are not supported for web
Upvotes: 0
Reputation: 599061
At the moment there is no single Flutter+Firebase library that works for both web and mobile apps, so you will need to use two (incompatible) libraries.
Work is being done to rectify that situation, but there's no timeline for its release.
Also see:
Upvotes: 2