简体   繁体   中英

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 doctor shows no issues found

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) {
...
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM