Created
September 6, 2023 15:48
-
-
Save Reprevise/d5697fdb73bee5a13b99e1a03a106489 to your computer and use it in GitHub Desktop.
FutureOr<T?> analyzer compiler mismatch error
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'dart:async' show FutureOr; | |
import 'dart:math' show Random; | |
final rand = Random(); | |
void main() async { | |
final hi = await maybeString(); | |
maybeString()?.then((v) => v); // error mismatch here | |
} | |
FutureOr<String?> maybeString() { | |
if (rand.nextBool()) return null; | |
return Future.value('hello world'); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment