我安装了 flutter search field 0.6.2 包,添加项目时出现错误
I installed the flutter search field 0.6.2 package and I am getting an error while adding the item
我已经安装了一个包来向我的项目添加一个下拉字段,但我希望该字段看起来像 this video 中的那样。我收到以下错误。
//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',
],
),
),
],
),
),
错误代码:
错误代码:
错误信息:
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.
该错误意味着您将字符串列表传递到接受动态类型(任何类型)的 SearchFieldListItem 对象的列表中。尝试将列表中的项目添加到具有给定对象的列表中。
我已经安装了一个包来向我的项目添加一个下拉字段,但我希望该字段看起来像 this video 中的那样。我收到以下错误。
//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',
],
),
),
],
),
),
错误代码:
错误代码:
错误信息:
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.
该错误意味着您将字符串列表传递到接受动态类型(任何类型)的 SearchFieldListItem 对象的列表中。尝试将列表中的项目添加到具有给定对象的列表中。