Skip to content

Instantly share code, notes, and snippets.

@Reprevise
Created September 6, 2023 15:48
Show Gist options
  • Save Reprevise/d5697fdb73bee5a13b99e1a03a106489 to your computer and use it in GitHub Desktop.
Save Reprevise/d5697fdb73bee5a13b99e1a03a106489 to your computer and use it in GitHub Desktop.
FutureOr<T?> analyzer compiler mismatch error
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