Q:

Returning Class from function

Can someone explain why this does not work?
class Foo {
  Foo(this.foo);
  sayFoo() {
    print(foo);
  }
}

var test = () => Foo;
test()("blah").sayFoo(); // ERROR

A:

Dart currently doesn't support constructor tear-offs, but it's planned to be added to the language eventually.
test() returns a Type<Foo>, but that doesn't allow you to invoke the constructor.
What you can do to simulate tear-offs is creating a closure
var test = (String foo) => Foo(foo);
test("blah").sayFoo(); // should work now

