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).
Details:
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
}))
.cast<Map?>();
The error is:
E/flutter (30590): [ERROR:flutter/lib/ui/ui_dart_state.cc(186)] 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 Backendless.data.of("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!