In Dart/ flutter I have the following classes:
abstract class Base {
V foo<V, T>(T arg);
}
class Concrete implements Base {
@override
TypeA foo<TypeA, TypeB>(TypeB arg) {
//... do something and return TypeA variable x
return x;
}
}
TypeA and TypeB are user defined types. However, I get the error message: <The value of type TypeB can't be returned from method 'foo' because it has a return type of TypeB>. Wired! Could you help me to understand what is going on here. What I try to get to is a general API function foo() where the input and output type can be defined flexibly by implemented classes.