type_test_with_non_type
The name '{0}' isn't a type and can't be used in an 'is' expression.
Description
#The analyzer produces this diagnostic when the right-hand side of an is
or is!
test isn't a type.
Example
#The following code produces this diagnostic because the right-hand side is a parameter, not a type:
dart
typedef B = int Function(int);
void f(Object a, B b) {
if (a is b) {
return;
}
}
Common fixes
#If you intended to use a type test, then replace the right-hand side with a type:
dart
typedef B = int Function(int);
void f(Object a, B b) {
if (a is B) {
return;
}
}
If you intended to use a different kind of test, then change the test:
dart
typedef B = int Function(int);
void f(Object a, B b) {
if (a == b) {
return;
}
}
除非另有说明,文档之所提及适用于 Dart 3.7.3 版本,本页面最后更新时间: 2025-05-08。 查看文档源码 或者 报告页面问题。