![](/img/trans.png)
[英]Flutter(dart) error: The argument type can't be assigned to the parameter type 'dynamic Function(List<Student>?)'
[英]The argument type 'List<dynamic>' can't be assigned to the parameter type 'List<Value*>*' , flutter cupertino date picker inside form_bloc
我尝试遵循https://github.com/GiancarloCode/form_bloc/issues/64中关于使用来自select_dialog
的导入依赖项修改form_bloc
内的小部件的代码,实际上我尝试在 form_bloc 中实现 Cupertino 日期选择器小部件,如下所示:
我尝试先按照教程进行操作,但是当我按照教程操作时,此代码中会出现错误警报,并显示: The argument type 'List<dynamic>' can't be assigned to the parameter type 'List<Value*>*'
。 任何知道如何在 form_bloc 中插入 cupertino 小部件或知道如何修复错误的人,我真的需要你的帮助来解决它。
您的 state SelectFieldBlocState
不包含error
或items
,可能需要一种SelectFieldBlocState
代替
为此,您需要在那里进行检查
if (state is SelectFieldInitialState) {
return GestureDetector();
}
在这里, SelectFieldInitialState
只是SelectFieldBlocState
类型的 state 有error
和以下items
:
class SelectFieldInitialState extends SelectFieldBlocState {
final String error;
final List<Value> items;
const SelectFieldInitialState({
required this.error,
required this.items,
});
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.