Home > database >  The argument type 'Iterable<dynamic>' can't be assigned to the parameter type &
The argument type 'Iterable<dynamic>' can't be assigned to the parameter type &

Time:02-13

DropdownButton<String>(
              value: value,
              items: locationItems.map( DropdownMenuItem<String>(
                child: Text( widget.locationName ),
                value: "${widget.locationName}",
              )
              ),

CodePudding user response:

Map returns iteratable. Try to convert it to list.

DropdownButton<String>(
              value: value,
              items: locationItems.map( DropdownMenuItem<String>(
                child: Text( widget.locationName ),
                value: "${widget.locationName}",
              )
              ).toList<DropdownMenuItem<String>>(),

CodePudding user response:

The argument type 'List<DropdownMenuItem>' can't be assigned to the parameter type 'List<DropdownMenuItem>?

Make your declared variable as the type above will solve your poblem

  • Related