SDK documentation should point to "orNull" variants of iterator methods #45680
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
(Based on discussion at #42021 (comment))
A common usage pattern prior to null safety was to pass
() => null
as theorElse
parameter to one of theIterator
methodsfirstWhere
,lastWhere
, orsingleWhere
. With null safety, this doesn't work if the iterator element type is non-nullable, so we introduced the extension methodsfirstWhereOrNull
,lastWhereOrNull
, andsingleWhereOrNull
topackage: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
, orsingleWhere
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
, andsingleWhere
with information about the "orNull" variants of these methods.The text was updated successfully, but these errors were encountered: