Closed
Description
class A {}
class A2 extends A {}
class B<T extends A> {
const B({this.method});
final num Function(T)? method;
}
void main() {
final List<B<A>> list = [
B<A2>(method: (A2 data) => 1),
const B(),
];
final mention = list[0];
print(mention);
var method = mention.method;
print(method);
}
Output:
Instance of 'B<A2>'
Unhandled exception:
type '(A2) => int' is not a subtype of type '((A) => num)?'
#0 main (package:mark_content/asd.dart:20:24)
#1 _delayEntrypointInvocation.<anonymous closure> (dart:isolate-patch/isolate_patch.dart:297:19)
#2 _RawReceivePort._handleMessage (dart:isolate-patch/isolate_patch.dart:184:12)
Metadata
Metadata
Assignees
Labels
No labels