Struggling with making a dataQueryBuilder in Flutter

Hello, I recently asked a question on how to get relational data from my table, and finally managed to get that working when doing findFirst(). However, now I am trying to fetch ALL (3 :joy:) of my exhibitions from the table and want to access the linkedVenue information when I get them.

I believe the way for me to do this is by using a query builder, but there aren’t many/ any clear examples in the Flutter SDK,so I thought I’d ask here.

As it stands, the fetchedExhibits() function is the one I need help with:
Screenshot 2023-02-13 at 22.36.23

Currently, this is what I have in my Exhibits table:

Also if it’s relevant, I don’t need to access nested data in the linked object, just properties like name, address will suffice for this function (please see attached image of linked venue below).

Thanks for all your helps so far and hope to hear from you soon!


Hello, @Ilayda_B.

You need to call code like this:

    var query = DataQueryBuilder()
      ..related = ['linkedVenue'];

    var dbdata = await<Exhibit>().find(query);
    // working with result

IMPORTANT: You should to use callback(then) or await keyword but not both at the same time(your example uses then and await at the same time for one method).

Best Regards, Nikita.

1 Like