I need to do a null check:
onWillPop: () async {
return !await listOfKeys[tabController!.index].currentState!.maybePop();
},
Instead of "!" should I use "??". But I can't write it down. How can I do that?
CodePudding user response:
when you use the null safety operator ´??´ you should provide a fallback value:
onWillPop: () async {
return tabController != null
? !(await listOfKeys[tabController?.index].currentState?.maybePop() ?? false)
: false;
},