有没有比“ 不是 ” 更具体的表达方式!(o is T)?
/// Object (o) is not type (T)
///
/// Syntax that works but is not concise: `!(o is T)`
final word = 'drow';
if (!(word is String)) print('undoable');
Run Code Online (Sandbox Code Playgroud)
您可以使用o is! T:
if (word is! String) print('undoable');
Run Code Online (Sandbox Code Playgroud)
请参阅类型测试运算符。
| 归档时间: |
|
| 查看次数: |
38 次 |
| 最近记录: |