[英]how to write if else statement with passed data in dart (flutter app)
[英]How to write If statement in dart?
我正在写这样的 if 语句:
String value;
if(int.parse(value)) // I want to write a condition that if error appear while parsing
// (like value contains some strings) then if statement run
可以通过写try/catch来实现
try{
int.parse(value)
}
catch (e) {
// implement if statement
}
但我想用 if 语句来做到这一点
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.