如何根据 flutter 中的条件渲染小部件?

How do I render a widget based on a condition in flutter?

 Widget build(BuildContext context) => Scaffold(
    appBar: AppBar(
      title: Text(MyApp.title),
      centerTitle: true,
    ),
    body: (()=>{
      if(!list){
        return Register();
      }
      else{
        return Homepage();
      }
    })
  );

我的应用程序在初始化时从本地存储中获取一个列表,之后要呈现的下一页取决于列表是否为空。有没有办法根据条件确定要呈现哪个小部件?

Widget build(BuildContext context) => Scaffold(
    appBar: AppBar(
      title: Text(MyApp.title),
      centerTitle: true,
    ),
    body: list.isEmpty ? Register() : Homepage()
  );