type_test_with_non_type
名前「{0}」は型ではないため、「is」式で使用できません。
説明
#is または is! テストの右辺が型ではない場合に、アナライザーはこの診断を生成します。
例
#右辺が型ではなくパラメータであるため、以下のコードはこの診断を生成します。
dart
typedef B = int Function(int);
void f(Object a, B b) {
if (a is b) {
return;
}
}一般的な修正
#型テストを使用するつもりだった場合は、右辺を型に置き換えてください。
dart
typedef B = int Function(int);
void f(Object a, B b) {
if (a is B) {
return;
}
}別の種類のテストを使用するつもりだった場合は、テストを変更してください。
dart
typedef B = int Function(int);
void f(Object a, B b) {
if (a == b) {
return;
}
}