4

I am creating a flutter web app ,I want to connect my flutter web project with cloud firestore, is there any to connect my project to cloud firestore

I have try import cloud_firestore: ^0.12.5+2 in pubspec.yaml.

Because op depends on cloud_firestore >=0.3.0 which requires the Flutter SDK, version solving failed.

5 Answers 5

5

You can now use official cloud_firestore plugin in flutter web, just follow the instructions in readme page to integrate plugin.

Sign up to request clarification or add additional context in comments.

Comments

4

The FlutterFire plugin that you found only targets iOS or Android.

If you're targeting the web, use the firebase-dart plugin.

Also see a similar answer I gave yesterday here: Is there a Dart interface to Firestore - with API as in https://firebase.google.com/docs/firestore/quickstart?

1 Comment

Thank you so much, is it possible for me to know how to config the firebase_dart plugin in flutter web ?
4

You need to add the following dependency to your package manager:

cloud_firestore: 0.13.4 

There are a couple of extra steps to take when configuring for web. These involve adding some script references to your index.html file with Google's SDK reserved URL's (this assumes you will be deploying to google hosting or at least serving locally for testing purposes).

<script src="/__/firebase/7.9.2/firebase-app.js"></script> <script src="/__/firebase/7.9.2/firebase-auth.js"></script> <script src="/__/firebase/7.9.2/firebase-firestore.js"></script <script src="/__/firebase/init.js"></script> 

I previously wrote a step by step guide to connecting a Flutter Web app to Google Cloud Firestore, including an example contact form.

Refs :

https://medium.com/@mat_wright/connecting-a-flutter-web-form-to-google-cloud-firestore-f6bf7aa28f99

https://firebase.google.com/docs/hosting/reserved-urls

enter link description here

3 Comments

Your "step-by-step guide" is behind a pay-wall. Please update link to guide that does not require a subscription.
@malwr thank you. Some of the code is unclear to me as to how it's added, do you have a link to your .dart file(s) / on your Github?
0

For configuring Firestore and Firebase for Flutter Web this link will help a lot. I have tried to document all the steps required to configure: Configure Firestore & Firebase with Flutter Web

Comments

-1

maybe you need add dependencies: firebase_web: ^5.0.9 to your pubspec.yaml. this page can help you https://pub.dev/packages/firebase_web

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.