-1

I'm gettin stuck in put my image carousel from model carousel_model.dart enter image description here

enter image description here//i.stack.imgur.com/Qp92R.png

Md. Yeasin Sheikh
  • 54,221
  • 7
  • 29
  • 56

1 Answers1

0

Your CarouselModel's image variable data type is String. But reading a map can provide null data for unknown keys(the keys arent include on map).

You can provide default value on null case or do a null check then add into list.

Providing default empty string on null case.

=> CarouselModel(item['image']??"")).toList()

If item is nullable do item?['image']??""

Md. Yeasin Sheikh
  • 54,221
  • 7
  • 29
  • 56
  • im getting message like this The library 'package:flutter_swiper/flutter_swiper.dart' is legacy, and should not be imported into a null safe library. Try migrating the imported library. – MaskAnoton Sep 14 '22 at 03:54