Mackina
Mackina

Reputation: 83

Null check operator used on a null value dart/flutter

I am struggling to figure out an issue with a null check operator. For one, my code is the exact same in another area of my program and I am getting data just fine from it. I have gone over it and over it for the last two weeks and have found nothing that helps. As shown in my screen shots, I am actually seeing the data come in from my API call and the field that it is calling null, is not actually null. Please help as this is extremely frustrating.

enter image description here

enter image description here

Perhaps we can jump in a chat session and I can share more of my code specifics based on questions one would have in helping me resolve this issue.

Thanks!

Upvotes: 0

Views: 64

Answers (1)

Md. Yeasin Sheikh
Md. Yeasin Sheikh

Reputation: 63569

You are getting null value on controller.port, better check null and then render the image like

if(controller.port?.imageUrl!=null)  
    Image.network(controller.port!.imageUrl)

More about understanding-null-safety

Upvotes: 1

Related Questions