简体   繁体   English

引发了另一个异常:类型'(BuildContext,int)=>动态'不是类型'(BuildContext,int)=> Widget'的子类型

[英]Another exception was thrown: type '(BuildContext, int) => dynamic' is not a subtype of type '(BuildContext, int) => Widget'

I would like to know why I am receiving this exception and how I can fix it ? 我想知道为什么会收到此异常以及如何解决它? Code snippet would be helpful 代码段会有所帮助

I'm working on Flutter (Channel beta, v0.6.0, on Linux, locale en_US.UTF-8) 我正在使用Flutter(Linux上的Channel beta v0.6.0,语言环境为en_US.UTF-8)

Flutter doctor shows no issues found Flutter医生显示未发现任何问题

Due to flutter updates, functions rendering widgets need to have the return type explicitly stated 由于更新频繁,功能渲染小部件需要明确声明返回类型

Example : 范例:

If the function was previously defined as 如果该函数先前定义为

buildPhotos(BuildContext context, int index) {
...
}

Change this to 更改为

Widget buildPhotos(BuildContext context, int index) {
...
}

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 &#39;列表<dynamic> &#39; 不是类型 &#39;(BuildContext, int) =&gt; Widget&#39; 的子类型 - 'List<dynamic>' is not a subtype of type '(BuildContext, int) => Widget' flutter 参数类型 'Container Function(BuildContext, int)' 不能分配给参数类型 'Widget Function(BuildContext, int, int)' - The argument type 'Container Function(BuildContext, int)' can't be assigned to the parameter type 'Widget Function(BuildContext, int, int)' 通用飞镖:类型 &#39;(BuildContext, String) =&gt; Padding&#39; 不是类型 &#39;(BuildContext, dynamic) =&gt; Widget&#39; 的子类型 - Generic dart: type '(BuildContext, String) => Padding' is not a subtype of type '(BuildContext, dynamic) => Widget' &#39;(BuildContext, Exception) =&gt; void&#39; 不是类型 &#39;(BuildContext, Exception) =&gt; () =&gt; void&#39; 的子类型 - '(BuildContext, Exception) => void' is not a subtype of type '(BuildContext, Exception) => () => void' 未处理的异常:“Null”类型不是“BuildContext”类型的子类型 - Unhandled Exception: type 'Null' is not a subtype of type 'BuildContext' type &#39;(BuildContext, Widget) =&gt; ChangeNotifierProvider&lt;&gt;&#39; 不是类型转换中类型 &#39;(BuildContext, Widget?) =&gt; Widget&#39; 的子类型 - type '(BuildContext, Widget) => ChangeNotifierProvider<>' is not a subtype of type '(BuildContext, Widget?) => Widget' in type cast 抛出了另一个异常:“String”类型不是“score”的“int”类型的子类型 - Another exception was thrown: type 'String' is not a subtype of type 'int' of 'score' 参数类型“Widget Function(BuildContext, Object?)”不能分配给参数类型“Widget Function(BuildContext, dynamic, VxStatus? - The argument type 'Widget Function(BuildContext, Object?)' can't be assigned to the parameter type 'Widget Function(BuildContext, dynamic, VxStatus? flutter:引发了另一个异常:类型'Future<dynamic> ' 不是类型 'String' 的子类型</dynamic> - flutter: Another exception was thrown: type 'Future<dynamic>' is not a subtype of type 'String' 无法将参数类型“Widget Function(BuildContext)”分配给参数类型“Widget Function(BuildContext, Widget)”? - The argument type 'Widget Function(BuildContext)' can't be assigned to the parameter type 'Widget Function(BuildContext, Widget)'?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM