【发布时间】:2020-11-12 14:07:40
【问题描述】:
我有一个简单的代码如下:
TextFormField(
initialValue: otp ?? "",
),
SizedBox(height: getProportionateScreenHeight(20.0)),
Text(otp ?? ""),
SizedBox(height: getProportionateScreenHeight(20.0)),
现在我从 api 提供 otp 的函数调用 api,并且需要在 TextFieldInput 中显示,而 TextFieldInput 根本没有显示!但它显示在Text Widget 中。可能是什么问题。
void processCoupon() async {
try {
if (_terms) {
print("processing mobile number !");
var data = {"mobile": _authModel.mobile};
ApiCall().postData(data, cApi).then((result) {
print(result);
if (result["data"] != null) {
print(result["data"]["otp"]);
setState(() {
otp = result["data"]["otp"].toString();
});
}
});
} else {
print("terms not agreed !");
}
} catch (e) {
print(e);
}
}
【问题讨论】:
-
你得到了什么
print(result["data"]["otp"]);? -
OTP 编号。
标签: flutter dart input-field