在 Flutter 中,可以使用 'is' 关键字来判断类型是否相等。例如:

var value = 10;
if (value is int) {
  print('value is an integer');
} else {
  print('value is not an integer');
}

这里的 'is' 关键字可以用于任何类型,包括基本类型和自定义类型。


原文地址: https://www.cveoy.top/t/topic/gQLG 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录