I run into an Data fetching Problem as soon as I try to fetch a Table with Flutter Web. The same code works fine on Flutter Android and iOS Build. Login and Server communication works also fine and on my Networktraffic, I can see that the Table Fetch and Backendless response looks good and normal.
This is the error Message I got on my console:
Resolving DataTable classes from the global scope is deprecated and it won’t be supported in the nearest future. Instead, you should register your DataTable classes using the following method Backendless.Data.mapTableToClass
Error: PlatformException(error, TypeError: s is not a constructor, null, null)
dart-sdk/lib/internal/js_dev_runtime/private/ddc_runtime/errors.dart 266:49 throw
packages/flutter/src/services/message_codecs.dart 653:7 decodeEnvelope
packages/flutter/src/services/platform_channel.dart 296:18 _invokeMethod
dart-sdk/lib/async/zone.dart 1653:54 runUnary
dart-sdk/lib/async/future_impl.dart 147:18 handleValue
dart-sdk/lib/async/future_impl.dart 766:44 handleValueCallback
dart-sdk/lib/async/future_impl.dart 795:13 _propagateToListeners
dart-sdk/lib/async/future_impl.dart 566:5 [_completeWithValue]
dart-sdk/lib/async/future_impl.dart 639:7 callback
dart-sdk/lib/async/schedule_microtask.dart 40:11 _microtaskLoop
dart-sdk/lib/async/schedule_microtask.dart 49:5 _startMicrotaskLoop
Im running Flutter 3.3.10 and backendless sdk: 7.2.7 on MacOS and Chrome.
In my understanding, this is a backendless sdk exception right?
It looks like a client side problem - seems that SDK unable to locate appropriate constructor in class associated with data table. Maybe your class lacks no-args constructor?
It just guess from my side since I am not Flutter dev. If it is not a reason of the problem I will create an internal ticket and my colleague will look to it during this week when he returns from vacation.
There is also the Massage “Resolving DataTable classes from the global scope is deprecated and it won’t be supported in the nearest future. Instead, you should register your DataTable classes using the following method Backendless.Data.mapTableToClass” which I did not nee on iOS and Android.
Since the classname Location is unfortunately very general, could it be that on Flutter Web the SDK confuses the class with a class with the same name? Can I somehow find out which Classes are registered for which table?
ps.: Parsing the pure JSON outside the “.find(queryBuilder)” went fine on any platform.
with all my classes, but that didn’t made a difference.
Is there maybe a special “Flutter JS Compiler” flag, which I cloud try?
I did some unit test, where I pipe the original Backendless response against my Classes and everything worked fine.
Could you explain me the error “Resolving DataTable classes from the global scope is deprecated and it won’t be supported in the nearest future. Instead, you should register your DataTable classes using the following method Backendless.Data.mapTableToClass” ? Maybe this is a hint, because this message is independent comes even if I register all my DataTable classes and it comes only on Flutter Web.
We reproduced the issue and found a solution. The problem is that JS looks in the global scope for a class called Location and finds the system class.
But the release will be in the coming weeks.
As a workaround, you can simply rename the Location table to, for example, LocationUniq or Location2.
Additionally, regarding the warning, it fires when JS looks for a class by name in the global scope. This functionality will be changed and the warning will no longer appear. It will be included in the release, along with a fix for the problem described above.
Thanks Nikita and the team behind you. In my case, renaming the Backendless Table would have larger side effects and the behavior with already shipped iOS and Android apps is currently unknown. Therefore, I am looking forward to the fix included in the next release and will wait to continue my work on the web port until then.