I have this code:
void baz(String s) {
}
void bar<T>(T val, void Function(T) encode) {
}
void foo() {
(<String>(val) => bar<String>(val, baz))("foo");
}
However it gives this error:
The argument type 'void Function(String)' can't be assigned to the parameter type 'void Function(String)'. dart(argument_type_not_assignable)
A confusing error to say the least! What is going on here?