Flutter_form_builder: Is there any way to clear a dropdown filed as setAttributeValue dose not clear the UI

Created on 7 Sep 2019  ยท  1Comment  ยท  Source: danvick/flutter_form_builder

Hello,

I'm trying to clear / reset a dropdown field by using setAttributeValue, but it does not change in UI, further more I can't clear the dropdown value as I can't use controller attribute.
My issue is I have to tow linked dropdown fields and while the user select a value from the second dropdown and then change the first dropdown I got following issue:

โ•โ•โ•โ•โ•โ•โ•โ• Exception Caught By widgets library โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•
The following assertion was thrown building FormField-LabeledGlobalKey>#11791:
'package:flutter/src/material/dropdown.dart': Failed assertion: line 608 pos 15: 'items == null || items.isEmpty || value == null || items.where((DropdownMenuItem item) => item.value == value).length == 1': is not true.

Either the assertion indicates an error in the framework itself, or we should provide substantially more information in this error message to help you determine and fix the underlying cause.
In either case, please report this assertion by filing a bug on GitHub:
https://github.com/flutter/flutter/issues/new?template=BUG.md

When the exception was thrown, this was the stack:

2 new DropdownButton (package:flutter/src/material/dropdown.dart:608:15)

3 _FormBuilderDropdownState.build. (package:flutter_form_builder/src/fields/form_builder_dropdown.dart:104:20)

4 FormFieldState.build (package:flutter/src/widgets/form.dart)

5 StatefulElement.build (package:flutter/src/widgets/framework.dart:4012:27)

6 ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:3924:15)

...
โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•
I understand this is Material dropdown library issue, but I figure out if I reset the form just after I return the list from the API based on first dropdown value the issue is not there.. but this does not the solution for it as on every change on first dropdown it will reset every thing.

I saw one of the issues and the workaround was to add controller but can't do the same in FormBuilderDropdown.

Please help me.

Thanks in advance.

>All comments

Support Sucks here!!! Closing... for no support!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

abhinavc picture abhinavc  ยท  6Comments

gilthonweapps picture gilthonweapps  ยท  3Comments

ryanhz picture ryanhz  ยท  6Comments

shashikantleher picture shashikantleher  ยท  5Comments

rdcoder33 picture rdcoder33  ยท  6Comments