Skip to content

Instantly share code, notes, and snippets.

@xvrh
Last active June 10, 2020 21:01
Show Gist options
  • Save xvrh/2d0bc36ec1f3a5ade5550c0944702d73 to your computer and use it in GitHub Desktop.
Save xvrh/2d0bc36ec1f3a5ade5550c0944702d73 to your computer and use it in GitHub Desktop.
Try to use firstWhere with dart null safety
void main() {
var list = ['a', 'b', 'c'];
String? d = list.firstWhere((e) => e == 'd', orElse: () => null);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment