Here, we will see how to add data to firestore collection. We have to do the below things First we get collection reference like below Then we add the add() to it. Inside this we need to map or json format data. Let’s take a look at our function that will add data to the…
Month: February 2023
Firestore set data
Make sure you have you firebase project set up. We will use firestore collection() and set() to set data to firestore collection. Since we need to use the set(), we need document ID. For document ID, we need to get all the documents. First we get all the documents using get() and then we access…
Flutter Getx Find Current Route or Path
If you use Getx, it’s easy to find current route or path in Flutter. Flutter Getx provides one of the best solution for finding your current route in Flutter app. First make sure you installed Getx package and you are wrapping your MaterialApp() using GetMaterialApp(). I use the below syntax to do it Here I…
How do I get collection data in firebase?
It’s easy to get collection data in Firebase. Just use the get() function with your collection name. Let’s take a look at the code below Here we need to use FirebaseFirestore.instance to get a reference of the Firestore instance. Then we mention the collection name. With the collection name we use the get() function. get()…
Error: Error when reading ‘../../.pub-cache/hosted/pub.dev/get-4.6.1/lib/get.dart/’: Not a directory
If you import a library or package and you may get Error: Error when reading ‘../../.pub-cache/hosted/pub.dev/get-4.6.1/lib/get.dart/’: Not a directory. It happens because your path is not a directory. In flutter, if you import a package or a file it must end with .dart. But from the error you see there’s an extra slash. After slash…
FlutterFire Messaging: An error occurred in your background messaging handler
If you work with firebase messaging and wanna get background message, you may get this error. I got this error as I was working in my video chatting app. At first glance it may look like a Getx error, but it’s not. The entry point of this error is FirebaseMessaging.oBackgroundMessage is the function that takes…