Home > Software engineering >  i want to make many different images but this just show up Exception has occurred. _TypeError (type
i want to make many different images but this just show up Exception has occurred. _TypeError (type

Time:04-20

i want to make many different images using listView builder img

CodePudding user response:

Image.asset takes a string not, in this case you can either have your widgets as

list a =[

'assets/myimage.png',
'assets/myimage.png']

or change the Image.asset in your listview to as your list a =[] returns a widget of type Image.asset

return a[index]

CodePudding user response:

You are using redundand Image.asset.

Your code at line 25:

return Image.asset(Image.asset('.../.../sth.png'))

Change 25 line to :

return a[index]

You can read more about this topic here: https://docs.flutter.dev/development/ui/assets-and-images

  • Related