The argument type 'List<dynamic>' can't be assigned to the parameter type 'List<Value*>*' , flutter cupertino date picker inside form_bloc

Issue

I tried to following the the code from https://github.com/GiancarloCode/form_bloc/issues/64 about modify widget inside form_bloc using import dependencies from select_dialog, actually i try to implementing cupertino date picker widget inside form_bloc just like this:

enter image description here

I try to follow the tutorial first, but when i follow the tutorial the error alert is appear inside this code, and it shows: The argument type 'List<dynamic>' can't be assigned to the parameter type 'List<Value*>*'. Anyone that know how to insert cupertino widget inside form_bloc or know how to fix the error, i really need your help to solve it.

Solution

your state SelectFieldBlocState doesn’t contain error or items,
maybe a type of SelectFieldBlocState is expected there instead

for that you’ll need to have a check there like

if (state is SelectFieldInitialState) {
  return GestureDetector();
}

here, SelectFieldInitialState is just a state of type SelectFieldBlocState having error and items like:

class SelectFieldInitialState extends SelectFieldBlocState {
  final String error;
  final List<Value> items;

  const SelectFieldInitialState({
    required this.error,
    required this.items,
  });
}

Answered By – iamdipanshus

Answer Checked By – Dawn Plyler (FlutterFixes Volunteer)

Leave a Reply

Your email address will not be published.