Skip to content

SDK documentation should point to "orNull" variants of iterator methods #45680

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
stereotype441 opened this issue Apr 13, 2021 · 1 comment
Labels
area-core-library SDK core library issues (core, async, ...); use area-vm or area-web for platform specific libraries. library-core type-documentation A request to add or improve documentation

Comments

@stereotype441
Copy link
Member

(Based on discussion at #42021 (comment))

A common usage pattern prior to null safety was to pass () => null as the orElse parameter to one of the Iterator methods firstWhere, lastWhere, or singleWhere. With null safety, this doesn't work if the iterator element type is non-nullable, so we introduced the extension methods firstWhereOrNull, lastWhereOrNull, and singleWhereOrNull to package:collection to ensure that users would still be able to get the behavior they want.

But we didn't add any documentation to firstWhere, lastWhere, or singleWhere explaining what we did. As a result, users are unlikely to discover the extension methods by themselves.

We should update the documentation for firstWhere, lastWhere, and singleWhere with information about the "orNull" variants of these methods.

@stereotype441 stereotype441 added area-documentation Prefer using 'type-documentation' and a specific area label. area-sdk Use area-sdk for general purpose SDK issues (packaging, distribution, …). labels Apr 13, 2021
@lrhn
Copy link
Member

lrhn commented Apr 14, 2021

Good idea.
We usually try to keep the platform libraries self-contained, but comment references to "core" packages is reasonable.

@lrhn lrhn added area-core-library SDK core library issues (core, async, ...); use area-vm or area-web for platform specific libraries. library-core type-documentation A request to add or improve documentation and removed area-documentation Prefer using 'type-documentation' and a specific area label. area-sdk Use area-sdk for general purpose SDK issues (packaging, distribution, …). labels Apr 14, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-core-library SDK core library issues (core, async, ...); use area-vm or area-web for platform specific libraries. library-core type-documentation A request to add or improve documentation
Projects
None yet
Development

No branches or pull requests

2 participants