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;
}
}
Was this page's content helpful?
Thank you for your feedback!
Provide details Thank you for your feedback! Please let us know what we can do to improve.
Provide details Unless stated otherwise, the documentation on this site reflects Dart 3.8.1. Page last updated on 2025-05-08. View source or report an issue.