Reputation: 425
I am using version sdk: ">=2.7.0 <3.0.0" I had a problem with the key
Upvotes: 0
Views: 225
Reputation: 14775
Try below code hope its helpful to you.
add null check
to Key
Refer null safety here and here
const CategoriesScreen({Key? key}) : super(key: key);
Upvotes: 0
Reputation: 1537
you can use ?
null safe as :
This is only example how could you use it:
child: Column(
children: <Widget>[
Consumer<UserProvider>(builder: (context, model, child) {
final userData = model.userModels;
return userData == null
? Container()
: Row(
children: <Widget>[
Container()
])})])
for more you can refer here
Upvotes: 1