Flutter Realtions Reterival

Anyone have any code for how to retrieve relational databases via flutter? I read through the docs and keep getting stuck.

1 Like

Hello.
You can retrieve an object along with its dependencies(ALL relations, depth is 1. If children have dependent objects, they will not be retrieved):

    DataQueryBuilder queryBuilder = DataQueryBuilder();
    queryBuilder.relationsDepth = 1;
    var result2 = await Backendless.data.of('TestTable').find(queryBuilder);

In this way, you can extract an object and specify which dependencies it should contain:

    List<String> related = [
      'RelatedTable',
      'Orders'
    ];

    DataQueryBuilder queryBuilder = DataQueryBuilder();
    queryBuilder.related = related;
    var result2 = await Backendless.data.of('TestTable').find(queryBuilder)

Or this way you can fetch ONLY the dependent object without fetching the parent:

    var rel = LoadRelationsQueryBuilder.of('Order');
    var result2 = await Backendless.data.of('TestTable').loadRelations(objectId, rel);

Best Regards, Nikita.

@Nikita_Fedorishchev any thoughts on this?

Hello, @Dustin_Miller.

I don’t quite understand what “no access” means. Could you clearly write the essence of your problem?

Regards, Nikita.