Closed
Description
Repro:
import 'dart:async';
void main() async {
Completer<String>().complete(Future.value('hello'));
}
dartanalyzer --enable-experiment=non-nullable
reports no errors.
Trying to run with dart --enable-experiment=non-nullable --null-safety
fails:
try.dart:4:39: Error: The argument type 'Future<String?>' can't be assigned to the parameter type 'FutureOr<String>?'.
- 'Future' is from 'dart:async'.
- 'FutureOr' is from 'dart:async'.
Completer<String>().complete(Future.value('hello'));
^
The workaround is to specify Future<String>.value(...)