1

I have a firestore table of users, and another firestore table of blogs which has uid on each document. I would like to do join query in flutter by joining the two tables by their uid. I can't find a way of doing this in the fire quiz state management. I wanted to define a new class class.

BlogData<T> {
  final Firestore _db = Firestore.instance;
  final String path; 
  CollectionReference ref;
  BlogData({ this.path }) {
    ref = _db.collection(path);
  }
  Future<List<T>> getData() async {
    // get blog data and do a join here to a user document by uid (document/blog.uid) return a future of blogs with user data such as name, country added to each blog in the future list.
  }
  Stream<List<T>> streamData() {
    // get blog data and do a join here to the user document  by uid (document/blog.uid) return a stream of blogs with user data such as name, country added to each blog in the stream.
  }
}

How can I achieve this?

Doug Stevenson
  • 297,357
  • 32
  • 422
  • 441
LearnToday
  • 2,762
  • 9
  • 38
  • 67

0 Answers0