I want to develop a flutter app for android, ios and web. My idea was to use flutter so that I can build all of those three components with the same source code. As a DB I decided to use cloud firestore, as I thought that it would have the easiest flutter integration. For android it works great, however for web my code seems unusable.
I came across this plugin list, and it seems the only plugins available also for web are firebase_core and firebase_auth:
https://github.com/FirebaseExtended/flutterfire#available-flutterfire-plugins
So now I have the following questions:
What can I do with the firebase_core plugin? Can I access my firestore DB? (There seems to be no real documentation..)
To learn what you can do with the firebase-core plugin, have a look at the sample app for it.
Mostly it allows you to create FirebaseApp objects, which you need to create any of the other Firebase service objects (such as FirebaseAuth). So while you can't really do anything meaningful with just firebase-core, it is a prerequisite for most other Firebase services.
Related
I want to create firebase dynamic-link when a document gets created in my database and update the same document with field shareable_link : created_dynamic_link.
How can I use Cordova Plugin Cordova plugin for Firebase Dynamic Links inside Firebase Function onCreate() event which gets triggered whenever new document is created in my database and I update the document available in snapshot of onCreate() event with dynamic-link created by mentioned Cordova plugin?
I don't know if I can include Cordova plugins right away in Firebase functions.
Also, are there any other alternatives?
PS : I thought do including cordova plugins since I am building an android app using Ionic-framework with cordova plugins.
EDIT : onCreate() is a Firebase Cloud Function event https://firebase.google.com/docs/functions/database-events
Yes, it's possible to use Cordova with Firebase. Regarding the Cordova plugin for Firebase Dynamic Links, I believe you are mentioning the plugin on Github here. This plugin seems to be developed only for iOS and Android, so, in case you are developing for these environments, you should be good to go, using the variables on your onCreate() method. In case you are not, I believe you will need to adapt the code to your needs.
However, it's not possible to to integrate Cordova plugin to Cloud Functions.
Besides that, I found these two below articles with tutorials and information on using Firebase with Cordova - they are messaging apps, but I believe you should be able to get further information on the way you can integrate and use both together.
Cordova Firebase Plugin
Firebase Cloud Messaging Integration for Cordova Hybrid Apps
Let me know if the information helped you!
After 2 weeks of UI code for my desktop app I just found out that firebase doesn't support flutter desktop, Sqflite doesn't work too. So I how can I access any kind of database for flutter desktop?
I've already tried Sqflite and Firebase, and Rest API isn't enough.
According to this page:
The Flutter desktop APIs are still in early stages of development, and are subject to change without warning. No backwards compatibility, either API or ABI, will be provided. Expect any code using these libraries to need to be updated and recompiled after any Flutter update
Writing plugins is supported on all platforms, however there are currently very few plugins that actually have desktop support.
You can find some plugins that can be used on desktop on the following link:
https://github.com/google/flutter-desktop-embedding/tree/master/plugins
Currently there is no plugin for firebase on flutter desktop or any other database.
Flutter desktop is still in early stages so it's probably better not to use it for production.
Finally, the Supabase Works perfectly on Desktop and all other platforms.
Also, for a local Database Hive a Works.
This Firestore document
https://firebase.google.com/docs/firestore/quickstart
Shows samples of 10+ languages but not Dart.
I found, there is a
https://pub.dev/packages/cloud_firestore
which appears to be a Flutter packageinterfacing Firestore.
Two questions:
Can the package in https://pub.dev/packages/cloud_firestore be used from server side Dart, or does in depend on something in Flutter?
Is it's API equivalent to that described in https://firebase.google.com/docs/firestore/quickstart
There are two main plugins that allow you to access Firestore from Dart code:
The FlutterFire plugin. Use this plugin if you're targeting iOS or Android with your Flutter app, as it is a wrapper around Firebase's native SDKs for those platforms.
The firebase-dart plugin. Use this plugin if you're targeting Web with your Flutter app.
There are no plugins that are more official than these two, as they are part of the Flutter and Firebase organizations respectively.
After 2 weeks of UI code for my desktop app I just found out that firebase doesn't support flutter desktop, Sqflite doesn't work too. So I how can I access any kind of database for flutter desktop?
I've already tried Sqflite and Firebase, and Rest API isn't enough.
According to this page:
The Flutter desktop APIs are still in early stages of development, and are subject to change without warning. No backwards compatibility, either API or ABI, will be provided. Expect any code using these libraries to need to be updated and recompiled after any Flutter update
Writing plugins is supported on all platforms, however there are currently very few plugins that actually have desktop support.
You can find some plugins that can be used on desktop on the following link:
https://github.com/google/flutter-desktop-embedding/tree/master/plugins
Currently there is no plugin for firebase on flutter desktop or any other database.
Flutter desktop is still in early stages so it's probably better not to use it for production.
Finally, the Supabase Works perfectly on Desktop and all other platforms.
Also, for a local Database Hive a Works.
I'm trying to integrate Firebase into my expo app using the react-native-firebase framework which has several advantages over the regular firebase package when it comes to react-native apps.
However, I'm running into difficulties since the instructions say I must add the GoogleService-Info.plist to ios/[YOUR APP NAME]/GoogleService-Info.plist, and expo apps don't have an ios folder from what I understand.
Am I pretty much screwed or is there a solution for this?
As the react-native-firebase documentation says, you need to eject your app if you want to use this library with expo. Be mind that eject action is not reversible. More info here and here and here.
If you use Expo and would like to use this package, you'll need to
eject. If you do not want to eject, but wish to make use of features
such as Realtime Database (without offline support) & Authentication,
you can still use the Firebase Web SDK in your project.
Today, you can't have the Firebase react-native sdk with expo. And this is not planned according to: https://expo.canny.io/feature-requests/p/full-native-firebase-integration.
So you have to play only with the javascript sdk from Firebase.
Cloud Firestore is new, it will be better for the javascript sdk for offline and sync.
The author of this thread: Fresh Detached Expo + RNFirebase not running on Android has managed to get it working with the Detached ExpoKit - so it's not a full ejection and keeps the expo features.
I have asked for the steps he took so we can see about getting something added to our docs and possibly a Detached ExpoKit version of our starter app.
See the expokit detaching docs for information about ExpoKit.
It's in progress --
https://blog.expo.io/using-firebase-in-expo-e13844061832
Using Firebase in Expo
And how we plan on adding it to the client 😁
We are super excited to announce that we will be rolling out a suite of Unimodules that will provide you with easy access to native Firebase features! initially you will only be able to use these in a detached ExpoKit App. But over time we will be working to add these to vanilla Expo.
TL;DR
Here are the modules, you will need to detach to add them for now:
App/Core
Analytics
Authentication
Cloud Firestore
Cloud Functions
Instance ID
Performance Monitor
Realtime Database
Cloud Storage
Remote Config
Firebase Cloud Messaging
Remote Notifications
Dynamic Linking
Invites
Crashlytics
Also TL;DR
Here is a boilerplate: https://github.com/EvanBacon/expo-native-firebase
Update 02-12-2021
Guys expo's eas-build is now public. You can add custom native codes and use react-native-firebase. Here is the link to a youtube tutorial. The video is short and super easy to follow. Here is the link to the docs
Previous answer
If you are using Firebase using the mobile configuration, it does not work, but it worked smoothly when I tried the web configuration. Here is the youtube tutorial. Watch from 38:20 to set up.
I managed to get a working set of react-native with redux, firestore and expo. See Code example at Github.
But it costs the offline-persistence (see https://github.com/firebase/firebase-js-sdk/issues/436). So from my point of view it costs performance, because i need to be online to get a full working app with firestore and react-native.