Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error running in Flutter 2.0 #27

Open
agrigera opened this issue Mar 22, 2021 · 9 comments
Open

Error running in Flutter 2.0 #27

agrigera opened this issue Mar 22, 2021 · 9 comments

Comments

@agrigera
Copy link

Getting this error message all the time woth Flutter 2.0.3
It works when running flutter in no-sound mode (flutter run --no-sound-null-safety) but even then the "title" is not recognized and I get the default "Select"

======== Exception caught by gesture ===============================================================
The following _TypeError was thrown while handling a gesture:
type 'List<String?>' is not a subtype of type 'List?' of 'value'

When the exception was thrown, this was the stack:
#0 FormFieldState.didChange (package:flutter/src/widgets/form.dart)
#1 __MultiSelectDialogFieldViewState._showDialog.. (package:multi_select_flutter/dialog/multi_select_dialog_field.dart:369:29)
#2 MultiSelectActions.onConfirmTap (package:multi_select_flutter/util/multi_select_actions.dart:27:16)
#3 _MultiSelectDialogState.build. (package:multi_select_flutter/dialog/mult_select_dialog.dart:300:20)
#4 _InkResponseState._handleTap (package:flutter/src/material/ink_well.dart:991:20)
...
Handler: "onTap"
Recognizer: TapGestureRecognizer#85693
debugOwner: GestureDetector
state: possible
won arena
finalPosition: Offset(288.0, 617.7)
finalLocalPosition: Offset(40.0, 19.7)
button: 1
sent tap down

@jameshmread
Copy link

Same issue here. Running on Flutter v2.2.0
When running with null safety I get the following error when confirming selections. When running with --no-sound-null-safety it runs as normal.

The following TypeErrorImpl was thrown while handling a gesture: Expected a value of type 'List<String>?', but got one of type 'List<String?>'

 MultiSelectDialogField(
                      initialValue: vals,
                      items: vals
                          .map((e) => MultiSelectItem(e, e))
                          .toList(),
                      onConfirm: (values) {
                        setState(() {
                          print(values);
    }
)

@baconbyte
Copy link

baconbyte commented Jun 25, 2021

Same here running on 2.12.0, worked fine before upgrading project for null safety

List<DeviceType> testTypes = [
       DeviceType(name: "ABC", id: "123"),
       DeviceType(name: "XYZ", id: "456"),
  ];
......
MultiSelectDialogField(
                      title: Text("Device Types"),
                      items: testTypes.map((e) => MultiSelectItem(e, e.name)).toList(),
                      listType: MultiSelectListType.CHIP,
                      onConfirm: (values) {
                        _selectedDeviceTypes = values as List<DeviceType>;
                      },
                      buttonText: Text("Device Types"),
                    )

@tashfeenzaidi
Copy link

Getting same problem. when running on --no-sound-null-safety it is working as expected. Dont know how to solve this on null safety.
Flutter 2.4.0-1.0.pre.179 • channel master
======== Exception caught by gesture ===============================================================
The following _TypeError was thrown while handling a gesture:
type 'List<CountryState?>' is not a subtype of type 'List?' of 'value'

When the exception was thrown, this was the stack:
#0 FormFieldState.didChange (package:flutter/src/widgets/form.dart)
#1 __MultiSelectDialogFieldViewState._showDialog.. (package:multi_select_flutter/dialog/multi_select_dialog_field.dart:369:29)
#2 MultiSelectActions.onConfirmTap (package:multi_select_flutter/util/multi_select_actions.dart:27:16)
#3 _MultiSelectDialogState.build. (package:multi_select_flutter/dialog/mult_select_dialog.dart:300:20)
#4 _InkResponseState._handleTap (package:flutter/src/material/ink_well.dart:989:21)
#5 GestureRecognizer.invokeCallback (package:flutter/src/gestures/recognizer.dart:193:24)
#6 TapGestureRecognizer.handleTapUp (package:flutter/src/gestures/tap.dart:608:11)
#7 BaseTapGestureRecognizer._checkUp (package:flutter/src/gestures/tap.dart:296:5)
#8 BaseTapGestureRecognizer.handlePrimaryPointer (package:flutter/src/gestures/tap.dart:230:7)
#9 PrimaryPointerGestureRecognizer.handleEvent (package:flutter/src/gestures/recognizer.dart:558:9)
#10 PointerRouter._dispatch (package:flutter/src/gestures/pointer_router.dart:94:12)
#11 PointerRouter._dispatchEventToRoutes. (package:flutter/src/gestures/pointer_router.dart:139:9)
#12 _LinkedHashMapMixin.forEach (dart:collection-patch/compact_hash.dart:400:8)
#13 PointerRouter._dispatchEventToRoutes (package:flutter/src/gestures/pointer_router.dart:137:18)
#14 PointerRouter.route (package:flutter/src/gestures/pointer_router.dart:123:7)
#15 GestureBinding.handleEvent (package:flutter/src/gestures/binding.dart:440:19)
#16 GestureBinding.dispatchEvent (package:flutter/src/gestures/binding.dart:420:22)
#17 RendererBinding.dispatchEvent (package:flutter/src/rendering/binding.dart:289:11)
#18 GestureBinding._handlePointerEventImmediately (package:flutter/src/gestures/binding.dart:374:7)
#19 GestureBinding.handlePointerEvent (package:flutter/src/gestures/binding.dart:338:5)
#20 GestureBinding._flushPointerEventQueue (package:flutter/src/gestures/binding.dart:296:7)
#21 GestureBinding._handlePointerDataPacket (package:flutter/src/gestures/binding.dart:279:7)
#25 _invoke1 (dart:ui/hooks.dart:183:10)
#26 PlatformDispatcher._dispatchPointerDataPacket (dart:ui/platform_dispatcher.dart:285:7)
#27 _dispatchPointerDataPacket (dart:ui/hooks.dart:96:31)
(elided 3 frames from dart:async)
Handler: "onTap"
Recognizer: TapGestureRecognizer#78d8c
debugOwner: GestureDetector
state: possible
won arena
finalPosition: Offset(297.0, 754.3)
finalLocalPosition: Offset(33.6, 18.8)
button: 1
sent tap down

@Fanom2813
Copy link

Hello guys, i have the same issue here is there a wayaround it ?

@tashfeenzaidi
Copy link

Hello guys, i have the same issue here is there a wayaround it ?

yes, I solved it by changing the plugin file. Are you getting the exact same error?

@Yacine-Benali
Copy link

Hello guys, i have the same issue here is there a wayaround it ?

yes, I solved it by changing the plugin file. Are you getting the exact same error?

am having the same error, what do you mean by changing the plugin file ?

@tashfeenzaidi
Copy link

tashfeenzaidi commented Jul 29, 2021

I'm using MultiSelectBottomSheetField and if you check what this return you'll know why this error is coming. so i just go to its definition, it is returning this
return _MultiSelectBottomSheetFieldView<V>._withState(view as _MultiSelectBottomSheetFieldView<V>, state);
replace this with
return _MultiSelectBottomSheetFieldView<V?>._withState( view as _MultiSelectBottomSheetFieldView<V?>, state);
and this works for me. please check and let me know.

@agrigera
Copy link
Author

agrigera commented Aug 2, 2021

It didn't helped that fixed, still getting original error. I'm using MultiSelectChipField. Found the same return to apply the same fix.

@arturjnt
Copy link

In my case I changed

MultiSelectDialogField(

into

MultiSelectDialogField<ROLES?>(

and it works.

Of course use whatever you need instead of ROLES.

Thanks @tashfeenzaidi

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants