[英]I installed the flutter search field 0.6.2 package and I am getting an error while adding the item
I have installed a package to add a dropdownfield to my project, but I want the field to look like in this video .我已经安装了一个 package 来为我的项目添加一个下拉字段,但我希望该字段看起来像这个视频中的那样。 I am getting the below error.
我收到以下错误。
//DropdownSearch
Container(
height: MediaQuery.of(context).size.height * 0.7,
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.center,
children: [
Padding(
padding: EdgeInsets.all(20.0),
child: Text(
'Select a country',
style: TextStyle(
fontSize: 16, color: Colors.blueGrey),
),
),
Container(
child: SearchField(
suggestions: [
'Afghanistan',
'Turkey',
'Germany',
'France',
'Italy',
'Spain',
'United Kingdom',
'United States',
'Canada',
'Australia',
'New Zealand',
'India',
'Indonesia',
'Bangladesh',
'Sri Lanka',
],
),
),
],
),
),
Error code:错误代码:
Error code:错误代码:
Error message:错误信息:
The argument type 'List<String>' can't be assigned to the parameter type 'List<SearchFieldListItem<dynamic>>'.dartargument_type_not_assignable
Couldn't infer type parameter 'E'.
-- --
Tried to infer 'String' for 'E' which doesn't work:
Return type declared as 'List<E>'
used where 'List<SearchFieldListItem<_>>' is required.
The type 'String' was inferred from:
Parameter 'element' declared as 'E'
but argument is 'String'.
Consider passing explicit type argument(s) to the generic.
The error means that you are passing a List of string into a List that accepts SearchFieldListItem object with a type of dynamic(any type).该错误意味着您将字符串列表传递到接受 SearchFieldListItem object 类型为动态(任何类型)的列表中。 Try to add the items in your list into and List with the given object.
尝试使用给定的 object 将列表中的项目添加到列表中。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.