我创建了一个react native项目,并希望为我的项目启用流程。
我安装了流槽
npm install --save flow-bin
Run Code Online (Sandbox Code Playgroud)
但是,它返回
missing script: flow
Run Code Online (Sandbox Code Playgroud)
当我跑步时
npm run-script flow
Run Code Online (Sandbox Code Playgroud)
有人知道吗?谢谢!
在 Flutter 中,我使用 FutureBuilder 来显示来自 API 的数据。我想在出现错误时弹出一个错误对话框。
但是,当我调用 showDialog() 时,它会抛出错误
setState() or markNeedsBuild() called during build.
Run Code Online (Sandbox Code Playgroud)
这是我的代码
return FutureBuilder(
future: xxx,
builder: (context, snapshot) {
if (snapshot.hasData) {
//DO SOMETHING
} else if (snapshot.hasError) {
//TODO: Show Error
showDialog(
context: context,
builder: (BuildContext context) {
return AlertDialog(
title: Text("Error"),
content: Text("HAHAHA"),
actions: <Widget>[
FlatButton(
child: Text("No"),
),
FlatButton(
child: Text("Yes")
),
],
);
}
);
return Container();
} else {
//DO SOMETHING
}
},
Run Code Online (Sandbox Code Playgroud)
请帮助建议我如何在 FutureBuilder 中显示对话框。