Class 'List<dynamic>' has no instance method 'cast' with matching arguments

I have an issue when get data form a table have relationship with users table:
=> Class ‘List’ has no instance method ‘cast’ with matching arguments.
My table one to one to users and in query i set relationsDepth = 2
Hope any help!

Hello @Minh_Tuan_Vu

Please specify the SDK version.
An internal ticket BKNDLSS-25112 has been created. Our Flutter specialist will respond as soon as possible.


My team is still waiting for your response @Inna_Shkolnaya :slight_smile:

Hello @Minh_Tuan_Vu
Thank you for waiting

I increased the priority of the ticket. And we fix it as fast as possible.

Regards, Dima.

1 Like

Hi @Dima ,
Please fix as soon as possible as we are currently blocking at this point and our project is suspending cause by this bug,

Many thanks,

Hi, I’ve run into a similar issue following the backendless missions, using Flutter SDK to make a query in the database.

The SDK version is the latest one:

backendless_sdk: ^7.0.0-nullsafety.0

I was forced to use the latest (beta) version of Backendless Flutter SDK because the previous wouldn’t fit the dependencies I had (Firebase).


Specifically, the “Find” method is returning null internally and is unable to cast it to a map. The issue happens in the following code in data_store.dart.

Future<List<Map?>?> find([DataQueryBuilder? queryBuilder]) async =>
      (await _channel.invokeMethod(
              "Backendless.Data.of.find", <String, dynamic>{
        'tableName': _tableName,
        'queryBuilder': queryBuilder

The error is:

E/flutter (30590): [ERROR:flutter/lib/ui/] Unhandled Exception: NoSuchMethodError: The method 'cast' was called on null.
E/flutter (30590): Receiver: null
E/flutter (30590): Tried calling: cast<Map<dynamic, dynamic>?>()

Pretty sure that’s an issue with the null safety.

My own code is extremely simple:

var queryBuilder = DataQueryBuilder()..whereClause = "Name = 'Dallas'";

var response = await"City").find(queryBuilder);

Good luck fixing this, because effectively we can’t do any querying whatsoever as of now. Please make this an urgent fix!

@Minh_Tuan_Vu It’s very helpful to the developers to provide more information on your problem. If you’re under pressure, it should be the first thing you do!


ticket BKNDLSS-25112 is marked as Critical and our developer will investigate it as soon as possible.


Hi @Minh_Tuan_Vu

Can you please also provide the code sample to reproduce your issue and the Flutter SDK version you use?

Best Regards,

OK tks @Maksym_Khobotin2
My sample code:
DataQueryBuilder query = DataQueryBuilder()
…relationsDepth = 2
…pageSize = limit
…offset = offset
…sortBy = [“nickName”];
String where = “ownerId = ‘${AppPref.user.objectId}’”;
if (key != null)
where +=
" AND (nickName LIKE ‘%$key%’ OR phone1 LIKE ‘%$key%’ OR phone2 LIKE ‘%$key%’ OR lastName LIKE ‘%$key%’ OR firstName LIKE ‘%$key%’)“;
switch (type) {
case ContactViewType.buyer:
where += " AND type LIKE ‘%${ContactModel.buyer}%’”;
case ContactViewType.vendor:
where += " AND type LIKE ‘%${ContactModel.vendor}%’";
query.whereClause = where;
return await‘contact’).find(query);

And my table struct:

This error when querybuilder.relationsDepth = 2 or more :slight_smile:

Note: error at relationship with table users

We were able to reproduce your problem, @Minh_Tuan_Vu . Our engineers will release a fix for it as soon as possible.

Also, @Maxime_Franchot your issue is not related to the original one. And we couldn’t reproduce it. Moreover, the result of “internal” find mehtod could never return null. It would be nice if you could create a new topic and provide more details (full stacktrace, dart&flutter versions). And one more thing: can you try to run it with v.6.3.2?

Best Regards,

Yeah. Tks @Maksym_Khobotin2. Hope it will come with nullsafety.

Hi support team,

Sorry to ask you again and again but since 10 days we cannot advance on our project caused by this bug.
Please find some way to fix as it’s really critical and blocked bug.

Many thanks for your comprehension.

Hi, @Minh_Tuan_Vu

We understand how important it is to you and will make the fix as soon as possible. When changes are available we will let you know.


Many thanks for your reply. We’re waiting the fix…

@Maksym_Khobotin2 I heard about a new released version for today. Do you think that this contains the fix of the mentionned bug?

Yeap, this issue will also be resolved in new release :relieved:

@Maksym_Khobotin2 really happy to hear that. Many thanks for your support.

Hi @Minh_Tuan_Vu

We have released new version 7.0.0-nullsafety.1. Can you update plugin version and check if everything works fine for you now?

Best Regards,

@Maksym_Khobotin2 Okay many thank