FlutterFlow / flutterflow-issues

A community issue tracker for FlutterFlow.
120 stars 18 forks source link

Custom Widget property tied to PageState receives null on change and cannot be checked for null #3077

Closed gams1976 closed 2 months ago

gams1976 commented 3 months ago

Has your issue been reported?

Current Behavior

I have created a custom code widget, that has a String? property. On page, I tie this property to a String? Page State. When i change this state in code, the widget crashes (even tough I check for nulls, it gives a null check error). I have made experiments and if i reference the property, it crashes.

The code below causes the crash for null value: String getGroup(String? groupType, ClientStruct client) { if (groupType != null) { return groupType; } else { return "null"; } }

Current widget definition: class ClientGroupList extends StatefulWidget { const ClientGroupList({ super.key, this.width, this.height, this.clients, this.onItemClick, this.groupType, });

final double? width; final double? height; final List? clients; final Future Function(ClientStruct client)? onItemClick; final String? groupType;

@override State createState() => _ClientGroupListState(); }

Expected Behavior

not crash if null checked

Steps to Reproduce

create custom widget with property create page state attch widget proporty to state Change page state with action

Reproducible from Blank

Bug Report Code (Required)

IT4glcn15YpNpbxK1bqBKe9VqGIvKUh9bZc0r9pEGEshfJvmPJkhduDBTBFLYteLfVVUemCKimYy/86MjeLxJvA5EzmcGr5AyoRXQRbNWnqtaYTWDpGBOX9BBdlQIFOB4bWK3QokPvBvcnw46176e/CNG3qCf9qOYwx5e6fDbOY=

Context

Avoiding using custom widgets

Visual documentation

image

image

image

image

Additional Info

No response

Environment

- FlutterFlow version: FlutterFlow v4.1.54+
- Platform: Chrome
- Browser name and version: Chrome Versão 125.0.6422.142 (Versão oficial) 64 bits
- Operating system and version affected: Windows
paulperez-dev commented 3 months ago

Hi @gams1976! I noticed that the JSON file you are loading inside the Lottie animation is causing the error. The file is stored in Supabase, review if only authenticated users can access the resource.

gams1976 commented 3 months ago

@paulperez-dev doesn't make much sense but i deleted all the lottie animations and still the error is happening. The lottie animations where in a different page... And not related to the update state operation.

The problem happens in page HomePage When i change the page state "GroupingType".

github-actions[bot] commented 3 months ago

This issue is stale because it has been open for 7 days with no activity. If there are no further updates, a team member will close the issue.

gams1976 commented 3 months ago

@paulperez-dev

paulperez-dev commented 2 months ago

Hi @gams1976! Sorry for the late response. Can you please share a new bug report code with your current configuration from the actual page where you are facing the issue?

Also, please make the Lottie file accessible to anyone on the internet.

paulperez-dev commented 2 months ago

Closing this issue since we haven't heard back from you. If you are still facing the problem please submit a new issue. Have a great day!