Reputation: 117
Widget build(BuildContext context) => Scaffold(
appBar: AppBar(
title: Text(MyApp.title),
centerTitle: true,
),
body: (()=>{
if(!list){
return Register();
}
else{
return Homepage();
}
})
);
My application fetches a list from local storage on init afterwards the next page to be rendered depends on whether the list is empty or not. Is there a way to determine which widget to render base on a condition?
Upvotes: 0
Views: 928
Reputation: 3073
Widget build(BuildContext context) => Scaffold(
appBar: AppBar(
title: Text(MyApp.title),
centerTitle: true,
),
body: list.isEmpty ? Register() : Homepage()
);
Upvotes: 1