how to retrieve data from firebase to flutter? - flutter

I want to get data from firebase to my flutter app. I created a collection at firebase but don't know how to use it on flutter. Already I've done the setup process between flutter and firebase and also added necessary dependencies. but now I need help to get data from firebase. collection name '0xethocity' ;

Here's the documentation, try to implement it by yourself. Let us know if you get stuck.
https://firebase.google.com/docs/flutter/setup?platform=ios

Related

Firebase 9 & Flutter: How to initializeApp?

I am desperately trying to figure out how to initializeApp with Flutter (not React Native).
I know about the functions to use, but I can not find the firebaseConfig I need to pass into the function.
And no matter what I search for, every resources references to React Native, like as if nobody codes with Flutter since Firebase 9 has been released anymore (or I am the only dummy which is not able to resolve this by myself).
Can someone tell me where to get the firebaseConfig object from?
If I add a new app to my project, I only get the google-services.json, which does NOT include the firebaseConfig object I need to pass.
I understand your confusion now, let me explain. When the guy in the video talks about Firebase v9 he is talking about the SDK version which in the case of Javascript (which I suppose is his main topic in his channel) is currently 9.17.1 an the version 9 has been around since 2021 so it is not new. The different SDKs have their own versions for each platform so thinking it will be the same in every SDK is a mistake by itself. You can check the SDKS here. So there is no Firebase v9, there is a Firebase SDK for javascript version 9. They managed in that way in javascript and in flutter it is not the same. Being that the last update in the flutter SDK was literally yesterday I'm pretty sure they have their reasons to not implement the same functions in flutter since 2021.
Now, one of the thinks the guy talks in the video is deconstructing, which is something common in javascript. The way you do this in flutter is by using show.
So you would be doing this for example:
import 'package:cloud_firestore/cloud_firestore.dart' show FirebaseFirestore, QuerySnapshot; //Add everything you would be using
This way only the specific parts of the library will be imported and the amount of code the Dart VM has to load will be reduced.
As of the access to documents, it is still the same but you can easily create a helper class that contents your references to your collections and then just use that class to reduce the boilerplate code created by the firebase SDK.
You have to install the Firebase CLI and run firebase init.
You need to use the package firebase_core that will give you access to the class Firebase so you can use it to initialize your app Firebase.initializeApp() you can pass the default options for the current platform using Firebase.initilizeApp(options: DefaultFirebaseOptions.currentPlatform) usually your IDE will automatically import the corresponding package but in case it does not you would have to import 'firebase/firebase_options.dart';
An useful link to the documentation: Add Firebase to your Flutter App

Firebase performance always collecting data on Flutter when monitoring Custom URL

I am using Firebase Performance Monitoring for my Flutter app. I am using this package
dio: ^4.0.6
firebase_core: ^1.20.0
firebase_performance: ^0.8.2+1
I want to monitor the performance of network request custom URL for specific endpoints used in my app like this
It has been more than 24 hours already, but it is still collecting data, no data appears on the dashboard like the image above. what went wrong in here?
I believe I have put the correct URL, for example, my real URL is like this
https://api.myCompany.id/api/blueray/customer/profile
so I put specific custom URL in the firebase performance dashboard like this
api.myCompany.id/api/blueray/customer/profile
if I change the filter to 'All Network Request' like the image below, there is no record from our own backend/endpoint, it seems it only records the requests for some Google services.
am I missing something? I expect the data will automatically be collected by just installing that package above. do I need write some codes to populate the dashboard with data? or do I need to add native code?
I just add that package to my pubspec.yaml and run pub get, thats it

qraphql flutter : how to access cache data flutter

I want to control cache data in graphql flutter.
for example, I want to set a time for deleting cache or...
I use graphql_flutter in my project and I know I can use FetchPolicy, but I want to access more in cache data.
https://pub.dev/packages/graphql_flutter
so can anyone help me please? how can I do that?

Read Flutter Firebase

i have a database in firebase and i am trying to read it using flutter. I found this tutorial here https://medium.com/flutterdevs/explore-realtime-database-in-flutter-c5870c2b231f
it looks pretty easy so i followed the steps. I added the read function in my code and when i run it i get this error here https://gyazo.com/a1cfe40527ad9908dcd4edfcd36d2cc9
if i search the error, i only get the solution to clean and flutter get but this doesn't work do you guys have any ideas?

How to delete data from StreamController in Flutter Provider?

I am using provider to build my application, so the data is added to StreamController, and each time i refresh my app, it will call an API, and then push data to StreamController, and the question is how to remove the data before replacing with the new one?
controller.add(user);
To iterate the answer from the comment. There is no need to remove any data added to the StreamController instead, just adding a new data again will remove the old data from there. You can do something like this:
controller.add(newOne);
You can also check this reference to understand the concept of Stream with examples.