[英]How to write If statement in dart?
I am writing if statement like that:我正在写这样的 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
It can be achieved by writing try/catch可以通过写try/catch来实现
try{
int.parse(value)
}
catch (e) {
// implement if statement
}
But I want to do this with if statement但我想用 if 语句来做到这一点
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.