Reputation: 311
how to handle if text field return null and substitute with text for example " NOT AVAILABLE " I have this text field for example:
Text(
"${data['name']}",
style: TextStyle(
fontSize: 15,
fontWeight:
FontWeight.w300,
color: Colors.white),
),
in this case if collection from cloud firestore is null
Upvotes: 0
Views: 38
Reputation: 601
You can do it like this:
Text(
data.['name'] ?? "Not available",
style: TextStyle(
fontSize: 15,
fontWeight: FontWeight.w300,
color: Colors.white),
),
),
Upvotes: 2