Flutter Web Error

Hi,

I’m Testing the new Flutter Web support, I followed the steps in the installation guide but when I try to fetch objects from the Database I get the error:

PlatformException(error, NoSuchMethodError: invalid member on null: ‘forEach’, null)

The code is a simple find:

Future _buildWidget(BuildContext context) async {
final items = await Backendless.data.of(“Test”).find();
return Text(items.length.toString());
}

And the Backendless has been initialized before, Test exists as Table and has one record… ¿?¿?

Here is the test project:

Regards,
Dani

Hi @Dani_Sevilla

Let me check into it and get back to you.

Best Regards,
Maksym

Hi @Dani_Sevilla

I checked your project and found several issues.
First of all: you need you make sure the Backendless app is initialized before making requests. In your project the initApp and find calls are simultaneous. There is a chance the find request will be completed before initApp resulting in unexpected behaviour.
If you want to load some portion of data when app starts you can put the find request right after the initApp. Dont forget to run them consecutively using await keyword.
I updated your code and made the simplified working version:

BLWeb.zip (593.7 KB)

Let us know if this helps.

Best Regards,
Maksym

Hi @Maksym_Khobotin,

I have tested your attached project and I get the same error as you can see in the screenshot:

It runs for you? What can be problem?

Regards,
Dani

Can you please remove the setState... line and instead print the items?

Please also make sure to follow all the steps described here:

And update the Flutter to the latest version.