I am updating my app to comply the null safety right now. Still new and trying to figure things out. However, I am stuck on the if & else if statement.
return Container(
child:
if (_dashboardViewController.currentPage() == 'home') {
return HomeView();
} else if (_dashboardViewController.currentPage() == 'profile') {
return ProfileView();
} else if (_dashboardViewController.currentPage() == 'game') {
return GameView();
}
They are all Container widgets. But, I am receiving
The body might complete normally, causing 'null' to be returned, but the return type is a potentially non-nullable type. Try adding either a return or a throw statement at the end.
It worked before the null safety. I am quite lost where I can make this null safety. And, also, where can I put ? to allow to have null value in this case?