Reputation: 3292
I have this widget and it gives me
This function has a return type of 'Widget', but doesn't end with a return statement. Try adding a return statement, or changing the return type to 'void'.
...List.generate(_userSocialInfo.length, (index) {
if (index != 0) {
IconButton(
icon: FaIcon(
_socialIcon[index],
color: Colors.orange,
size: 40,
),
onPressed: _socialFunction[index],
);
}
}),
I've tried to add everywhere possible. However, it seems like I can not get that blue underline away. How can I make sure the widget returns void?
Upvotes: 0
Views: 450
Reputation: 1387
Use this code:
...List.generate(_userSocialInfo.length, (index) {
if (index != 0) {
return IconButton(
icon: FaIcon(
_socialIcon[index],
color: Colors.orange,
size: 40,
),
onPressed: _socialFunction[index],
);
}
return Container(height: 0);
}),
Upvotes: 3