変数に格納された Type のインスタンスを使用して、Dart でオブジェクトの型をテストすることは可能ですか? 例えば
Foo foo = new Foo();
Type testtype = Foo;
if (foo is testtype) {
print("foo matched testype");
}
これにより、次の警告が表示されます。
The name 'testtype' is not a type and cannot be used in an 'is' expression
これを行う方法はありますか?
最終的には、 Type をパラメーターとして関数に渡し、これを使用して「is」型テストを実行したいと考えています。