Access the a child value (Name) of UID without knowing the parent of the UID (User) in firebase using flutter
I want to access the value of Name which is John through UID without mentioning the parent node which is (User)
do you know?
how many words do you know
See also questions close to this topic
-
How can I fixed my problem"FirebaseError: Firebase: Error (auth/invalid-api-key)."
My environment variable is ok. No comas and name mistakes but they given me error like "FirebaseError: Firebase: Error (auth/invalid-api-key)". How can I fixed it. Please Help me...
This my .env file
REACT_APP_apiKey=AIzaSyBWobnhbdeMdNpXXXXXXXXXXXXXXXXXXXX REACT_APP_authDomain=XXXXX.firebaseapp.com REACT_APP_projectId=XXXX REACT_APP_storageBucket=XXXXX.appspot.com REACT_APP_messagingSenderId=4997390XXXXX REACT_APP_appId=1:4997390XXXXX:web:cc7bc80aa1bdb78fXXXXXX REACT_APP_measurementId=G-M1XDXXXXXX
This my firebase config file
const firebaseConfig = { apiKey: process.env.REACT_APP_apiKey, authDomain: process.env.REACT_APP_authDomain, projectId: process.env.REACT_APP_projectId, storageBucket: process.env.REACT_APP_storageBucket, messagingSenderId: process.env.REACT_APP_messagingSenderId, appId: process.env.REACT_APP_appId, measurementId: process.env.REACT_APP_measurementId, }; when I debugging firebaseConfig object console.log(firebaseConfig.apiKey); ==========> undefined console.log(firebaseConfig.authDomain); ==========> undefined console.log(firebaseConfig.projectId); ==========> undefined console.log(firebaseConfig.storageBucket); ==========> undefined console.log(firebaseConfig.measurementId); ==========> undefined console.log(firebaseConfig.appId); ==========> undefined console.log(firebaseConfig.measurementId); ==========> undefined
client side given error this "FirebaseError: Firebase: Error (auth/invalid-api-key)"
-
How to order comments in firebase firestore by createdAt
I have a document in which there is a comments array of objects and each object has createdAt property. I want to sort all the comments that are inside the comments array using the createdAt property, so, a new comment comes to the top.
I did some research and found that we can do this in firebase's real-time database but I want to do the ordering of data using firestore.
Here is my code:
import { useEffect, useRef, useState } from "react" // firebase import import { doc, onSnapshot, orderBy, query } from "firebase/firestore" import { db } from "../firebase/config" export const useDocument = (c, id, o) => { const [document, setDocument] = useState(null) const [error, setError] = useState(null) // realtime document data useEffect(() => { let docRef = doc(db, c, id) if (o) { docRef = query(docRef, orderBy("createdAt", "desc")) // this is not working } const unsubscribe = onSnapshot( docRef, (snapshot) => { // need to make sure the doc exists & has data if (snapshot.data()) { setDocument({ ...snapshot.data(), id: snapshot.id }) setError(null) } else { setError("No such document exists") } }, (err) => { console.log(err.message) setError("failed to get document") } ) // unsubscribe on unmount return () => unsubscribe() }, [c, id]) return { document, error } }
-
How to group firebase data in flutter with DateTime?
I am making a chat application in flutter using firebase. I want to show a header with the date whenever the date changes. How can I group messages in flutter coming from firebase on the basis of date and show a header with the changed date?
I have tried GroupedListView package but I was not able to retrieve the chatmessages successfully.
-
how to change prettier format for react native
my code formatting prettier didn't works well for react native, i don't understand where to config it but it works well with flutter
from this code
import { View, Text } from 'react-native' import React from 'react' export default function App() { return ( <View> <Text>Apps</Text> </View> ) }
it's formatted to this
import { View, Text } from 'react-native' import React from 'react' export default function App() { return ( < View > < Text > Apps < /Text> < /View> ) }
-
Can you make complete apps using Flutter & Dart or just the UI part of an app?
I'm confused about what Flutter framework actually does, I know that it uses Dart and have heard that both of them can be used to create cross-platform apps.
But Wikipedia defines Flutter as a "UI Framework", so my question is, can you make a complete app (for mobile) which also has backend part (communicates with a database) built entirely using Flutter & Dart and not only the UI part?
If you didn't get my question, here is an example:
Suppose a front-end web developer works on client side programming in his job, and the backend logic is written by another backend developer.
When it comes to mobile app development, suppose as a Flutter developer, your job is to create apps, but does that mean that as a Flutter developer, you'll only write the front-end logic and leave the backend part for another backend developer like in web world? Can Flutter developers also write the backend of an app using only Flutter & Dart? If not, then who writes the backend of a mobile app and what tools/languages/frameworks does he uses?
-
dart modulo operator circular list
I want to use the modulo (%) operator in order to access to list items in a circular way. But the code below doesn't work:
void main() { List<String> myList = ['one', 'two', 'three', 'four']; int currIdx = 0; for (int i = 0;i < 10;i++) { print(myList[currIdx]); currIdx = currIdx++ % myList.length; } }
-
Parse external JSON using Firebase Functions
I just started using Firebase a couple of days ago for my mobile app, so I’m sorry if this might come off as a stupid question, I’m still learning :)
Basically, what I want to achieve is to download and parse a JSON from an API and then store the parsed content in the Real Time Firebase Database, so I can later use it in my app. I want to achieve this with Firebase Functions, cause the JSON is pretty large and don’t want to process it on device, it would slow down the app. Basically I’d like for the parsing and storing to be done by one function, which would then automatically execute one time per day, at a given time. Is this something doable? Or should I be looking into Google Cloud for this type of thing.
I’m also new to JavaScript, so an example function would be really useful, to get a sense of how things look and feel.
Thank you so much!
-
Why getting firebase is not defined error?
Here's the code for firebase.js file where I m getting this error in spite of strictly adhering to the official documentation of firebase.
Firebase.js
import { initializeApp } from 'firebase/app'; import { getFirestore ,getDocs} from 'https://www.gstatic.com/firebasejs/9.6.3/firebase-firestore.js' import { collection} from 'https://www.gstatic.com/firebasejs/9.6.3/firebase-firestore.js' // TODO: Add SDKs for Firebase products that you want to use // https://firebase.google.com/docs/web/setup#available-libraries // Your web app's Firebase configuration const firebaseConfig = { //config }; // Initialize Firebase firebase.initializeApp(firebaseConfig);
-
How to get the name of child realtime database kotlin
I am trying to get the email (in this case mikeyreid2002@gmail.com) however I don't see any method I can use that gets me the name of the child instead of the value.