Snippet below consists of two files:
Opted-out:
// @dart = 2.6
import 'tt.dart';
import "dart:async";
class B implements A<int> {
then<B>() => Future<B>.value();
}
main() {}
Opted-in:
class A<R> {
Future<T> then<T>() => Future<T>.value();
}
errors with the null-safety experiment enabled with:
Error: The return type of the method 'B.then' is 'dynamic', which does not match the return type, 'Future<B>', of the overridden method, 'A.then'.
- 'Future' is from 'dart:async'.
Change to a subtype of 'Future<B>'.
then<B>() => Future<B>.value();
^
Context: This is the overridden method ('then').
Future<T> then<T>() => Future<T>.value();
^
but passes with the experiment disabled.