google-cloud-firestore

List<dynamic> is not a subtype of List<Option>

≯℡__Kan透↙ 提交于 2020-12-13 03:26:14
问题 I have a Cloud Firebase database with a questions collection. Each question has a list of map options . I'm using Flutter and have the following classes for question and option : class Question { final String text; final List<Option> options; // I have tried changing this to List<dynamic> but it doesn't help final String reference; Question(this.text, this.options, this.reference); Question.fromMap(Map<String, dynamic> map, {this.reference}) : text = map['text'], options = map['options']; //

List<dynamic> is not a subtype of List<Option>

五迷三道 提交于 2020-12-13 03:21:04
问题 I have a Cloud Firebase database with a questions collection. Each question has a list of map options . I'm using Flutter and have the following classes for question and option : class Question { final String text; final List<Option> options; // I have tried changing this to List<dynamic> but it doesn't help final String reference; Question(this.text, this.options, this.reference); Question.fromMap(Map<String, dynamic> map, {this.reference}) : text = map['text'], options = map['options']; //

Firebase, React: Changing a GET request from get() method to onSnapshot() method

岁酱吖の 提交于 2020-12-13 03:00:48
问题 I've written a function that gets data from my firestore, filters through it, and returns data posted only by the logged-in user. The data, in this case, are gig listings: authListener() { auth().onAuthStateChanged((user) => { if (user) { this.setState( { userDetails: user }, () => axios .get( "https://us-central1-gig-fort.cloudfunctions.net/api/getGigListings" ) .then((res) => { let filteredGigs = res.data.filter((gig) => { return gig.user === this.state.userDetails.uid; }); this.setState({

Firebase, React: Changing a GET request from get() method to onSnapshot() method

末鹿安然 提交于 2020-12-13 02:58:45
问题 I've written a function that gets data from my firestore, filters through it, and returns data posted only by the logged-in user. The data, in this case, are gig listings: authListener() { auth().onAuthStateChanged((user) => { if (user) { this.setState( { userDetails: user }, () => axios .get( "https://us-central1-gig-fort.cloudfunctions.net/api/getGigListings" ) .then((res) => { let filteredGigs = res.data.filter((gig) => { return gig.user === this.state.userDetails.uid; }); this.setState({

Firebase UID vs document-id and Firestore Rules

本秂侑毒 提交于 2020-12-12 11:35:07
问题 Hi I am getting a little bit confused here with Firebase User UID and Firestore Document ID (userId???)... and looking for some help :-) By creating a user I get a UID and I write it to the database let db = Firestore.firestore() db.collection("user").addDocument(data: [ "name": "confused", "uid": result!.uid ]) by doing so I get a unique document-id (marked green) which I thought is the userId as well: The thing I wanted to achieve is that the user can only read and write his document (green

How to implement a swipe to delete listview to remove data from firestore

冷暖自知 提交于 2020-12-12 06:04:33
问题 Im very new to flutter and dart so this might be a basic question. However, what I would like to know is how to implement a swipe to delete method in a listview to delete data from firestore too. I tried using the Dissmissible function but i dont understand how to display the list and I cant seem to understand how to remove the selected data as well. This here is my dart code Widget build(BuildContext context) { return new Scaffold( resizeToAvoidBottomPadding: false, appBar: new AppBar(

Firestore | Why do all where filters have to be on the same field?

左心房为你撑大大i 提交于 2020-12-12 04:58:23
问题 Apparently Firestore does not not support queries with range filters on different fields, as described here: My question is, WHY? HOW can I query by time and location for example: Firestore.instance.collection('events') .where("eventTime", isGreaterThanOrEqualTo: DateTime.now().millisecondsSinceEpoch) .where("eventLocation", isGreaterThan: lesserGeopoint) .where("eventLocation", isLessThan: greaterGeopoint) .where("eventStatus", isEqualTo: "created") .orderBy('eventLocation', descending:

Unable to subscribe after forkjoin

孤人 提交于 2020-12-12 02:12:03
问题 I want to perform some firebase operation inside a loop in angular. When I send an HTTP request to firebase it returns an array of observables so using forkjoin i convert this array of observables into single observables. Now the problem is when I subscribe to these new observables I didn't get anything get_student_email() { this.get_project_service .get_project_by_doc_id(this.batchID, this.projectID) .subscribe((res) => { this.response = res; this.email = this.response.student; let data =

Unable to subscribe after forkjoin

淺唱寂寞╮ 提交于 2020-12-12 02:11:13
问题 I want to perform some firebase operation inside a loop in angular. When I send an HTTP request to firebase it returns an array of observables so using forkjoin i convert this array of observables into single observables. Now the problem is when I subscribe to these new observables I didn't get anything get_student_email() { this.get_project_service .get_project_by_doc_id(this.batchID, this.projectID) .subscribe((res) => { this.response = res; this.email = this.response.student; let data =

Sort chat-list by the most recent message with firebase

拥有回忆 提交于 2020-12-10 08:35:03
问题 I don't know why I got stuck in a problem that the chatList is not sorting by the last message time or by the most recent message. I have tried storing timestamp in the database and orderChildBy timestamp but it still not working. not working means the list get not sort after every message and keep showing the list as the sorted after first message. Look at the image how chats are disordered! This is the way I created chatList in the firebaseDatabase in ChatActiviy on sendMessage: val timeAgo