'I'm new to flutter and trying to use spread operator and Map into a List but I get null safety error , tried using (!) but no good

enter image description here

I'm new to flutter and trying to use spread operator and Map into a List but I get null safety error , tried using (!) but no good.



Solution 1:[1]

Although I don't quite understand what you are talking about, I roughly understand where your code is wrong.

This is the example code:

change

_snapshot.data!.name

to

_snapshot.data?.name ?? "Unknown"

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Dharman