1

如何使用flutter_bloc包在blocbuilder中实现futurebuilder和snapshot。我在集团有点初学者,所以我需要一个未来建设者在集团的例子。

4

1 回答 1

2

请添加更多关于您正在尝试执行的操作的详细信息。FutureBuilder是一个小部件,因此您可以在如下builder属性中返回它BlocBuilder

Widget build(BuildContext context) {
    return BlocBuilder(
      builder: (context, state) {
        // here you should check about the state that is being provided
        return FutureBuilder(
          future: _future,
          builder: (context, snapshot) {
            //here you should check snapshot.connectionState
            return SizedBox();
          },
        );
      },
    );
}
于 2020-02-21T20:49:07.027 回答