cetorres / multiselect_formfield

A Flutter package that provides a multi select form field using alert dialog to select multiple items with checkboxes and showing as chips.
BSD 3-Clause "New" or "Revised" License
72 stars 59 forks source link

problem setting initialValue #28

Open AliEasy opened 4 years ago

AliEasy commented 4 years ago

when passing a list of string to initialValue , below exception occurs:

The following NoSuchMethodError was thrown building MultiSelectFormField(dirty, dependencies: [_FormScope, _InheritedTheme, _LocalizationsScope-[GlobalKey#d3d5a]], state: FormFieldState<dynamic>#31c19):
The method '[]' was called on null.
Receiver: null
Tried calling: []("title")

When the exception was thrown, this was the stack:
#0      Object.noSuchMethod (dart:core-patch/object_patch.dart:51:5)
#1      new MultiSelectFormField.<anonymous closure>._buildSelectedOptions.<anonymous closure> (package:multiselect_formfield/multiselect_formfield.dart:77:35)
#2      List.forEach (dart:core-patch/growable_array.dart:302:8)
#3      new MultiSelectFormField.<anonymous closure>._buildSelectedOptions (package:multiselect_formfield/multiselect_formfield.dart:69:29)
#4      new MultiSelectFormField.<anonymous closure> (package:multiselect_formfield/multiselect_formfield.dart:168:60)
#5      FormFieldState.build (package:flutter/src/widgets/form.dart:439:26)
#6      StatefulElement.build (package:flutter/src/widgets/framework.dart:4663:28)
#7      ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:4546:15)
#8      StatefulElement.performRebuild (package:flutter/src/widgets/framework.dart:4719:11)
#9      Element.rebuild (package:flutter/src/widgets/framework.dart:4262:5)
#10     ComponentElement._firstBuild (package:flutter/src/widgets/framework.dart:4525:5)
#11     StatefulElement._firstBuild (package:flutter/src/widgets/framework.dart:4710:11)
#12     ComponentElement.mount (package:flutter/src/widgets/framework.dart:4520:5)
...     Normal element mounting (9 frames)
#21     Element.inflateWidget (package:flutter/src/widgets/framework.dart:3490:14)
#22     MultiChildRenderObjectElement.mount (package:flutter/src/widgets/framework.dart:5991:32)
...     Normal element mounting (7 frames)
#29     Element.inflateWidget (package:flutter/src/widgets/framework.dart:3490:14)
#30     MultiChildRenderObjectElement.mount (package:flutter/src/widgets/framework.dart:5991:32)
#31     Element.inflateWidget (package:flutter/src/widgets/framework.dart:3490:14)
#32     Element.updateChild (package:flutter/src/widgets/framework.dart:3258:18)
#33     SingleChildRenderObjectElement.update (package:flutter/src/widgets/framework.dart:5881:14)
#34     Element.updateChild (package:flutter/src/widgets/framework.dart:3245:15)
#35     SingleChildRenderObjectElement.update (package:flutter/src/widgets/framework.dart:5881:14)
#36     Element.updateChild (package:flutter/src/widgets/framework.dart:3245:15)
#37     RenderObjectElement.updateChildren (package:flutter/src/widgets/framework.dart:5566:32)
#38     MultiChildRenderObjectElement.update (package:flutter/src/widgets/framework.dart:6001:17)
#39     Element.updateChild (package:flutter/src/widgets/framework.dart:3245:15)
#40     ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:4571:16)
#41     Element.rebuild (package:flutter/src/widgets/framework.dart:4262:5)
#42     StatelessElement.update (package:flutter/src/widgets/framework.dart:4627:5)
#43     Element.updateChild (package:flutter/src/widgets/framework.dart:3245:15)
#44     ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:4571:16)
#45     Element.rebuild (package:flutter/src/widgets/framework.dart:4262:5)
#46     ProxyElement.update (package:flutter/src/widgets/framework.dart:4906:5)
#47     Element.updateChild (package:flutter/src/widgets/framework.dart:3245:15)
#48     ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:4571:16)
#49     StatefulElement.performRebuild (package:flutter/src/widgets/framework.dart:4719:11)
#50     Element.rebuild (package:flutter/src/widgets/framework.dart:4262:5)
#51     StatefulElement.update (package:flutter/src/widgets/framework.dart:4751:5)
#52     Element.updateChild (package:flutter/src/widgets/framework.dart:3245:15)
#53     SingleChildRenderObjectElement.update (package:flutter/src/widgets/framework.dart:5881:14)
#54     Element.updateChild (package:flutter/src/widgets/framework.dart:3245:15)
#55     ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:4571:16)
#56     Element.rebuild (package:flutter/src/widgets/framework.dart:4262:5)
#57     StatelessElement.update (package:flutter/src/widgets/framework.dart:4627:5)
#58     Element.updateChild (package:flutter/src/widgets/framework.dart:3245:15)
#59     SingleChildRenderObjectElement.update (package:flutter/src/widgets/framework.dart:5881:14)
#60     Element.updateChild (package:flutter/src/widgets/framework.dart:3245:15)
#61     ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:4571:16)
#62     Element.rebuild (package:flutter/src/widgets/framework.dart:4262:5)
#63     StatelessElement.update (package:flutter/src/widgets/framework.dart:4627:5)
#64     Element.updateChild (package:flutter/src/widgets/framework.dart:3245:15)
#65     SingleChildRenderObjectElement.update (package:flutter/src/widgets/framework.dart:5881:14)
#66     Element.updateChild (package:flutter/src/widgets/framework.dart:3245:15)
#67     ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:4571:16)
#68     StatefulElement.performRebuild (package:flutter/src/widgets/framework.dart:4719:11)
#69     Element.rebuild (package:flutter/src/widgets/framework.dart:4262:5)
#70     StatefulElement.update (package:flutter/src/widgets/framework.dart:4751:5)
#71     Element.updateChild (package:flutter/src/widgets/framework.dart:3245:15)
#72     ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:4571:16)
#73     StatefulElement.performRebuild (package:flutter/src/widgets/framework.dart:4719:11)
#74     Element.rebuild (package:flutter/src/widgets/framework.dart:4262:5)
#75     StatefulElement.update (package:flutter/src/widgets/framework.dart:4751:5)
#76     Element.updateChild (package:flutter/src/widgets/framework.dart:3245:15)
#77     SingleChildRenderObjectElement.update (package:flutter/src/widgets/framework.dart:5881:14)
#78     Element.updateChild (package:flutter/src/widgets/framework.dart:3245:15)
#79     ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:4571:16)
#80     StatefulElement.performRebuild (package:flutter/src/widgets/framework.dart:4719:11)
#81     Element.rebuild (package:flutter/src/widgets/framework.dart:4262:5)
#82     StatefulElement.update (package:flutter/src/widgets/framework.dart:4751:5)
#83     Element.updateChild (package:flutter/src/widgets/framework.dart:3245:15)
#84     ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:4571:16)
#85     StatefulElement.performRebuild (package:flutter/src/widgets/framework.dart:4719:11)
#86     Element.rebuild (package:flutter/src/widgets/framework.dart:4262:5)
#87     BuildOwner.buildScope (package:flutter/src/widgets/framework.dart:2667:33)
#88     WidgetsBinding.drawFrame (package:flutter/src/widgets/binding.dart:866:20)
#89     RendererBinding._handlePersistentFrameCallback (package:flutter/src/rendering/binding.dart:286:5)
#90     SchedulerBinding._invokeFrameCallback (package:flutter/src/scheduler/binding.dart:1117:15)
#91     SchedulerBinding.handleDrawFrame (package:flutter/src/scheduler/binding.dart:1056:9)
#92     SchedulerBinding._handleDrawFrame (package:flutter/src/scheduler/binding.dart:972:5)
#96     _invoke (dart:ui/hooks.dart:253:10)
#97     _drawFrame (dart:ui/hooks.dart:211:3)
(elided 3 frames from dart:async)
jigarfumakiya commented 2 years ago

Same