docs: Add a warning about dart-lang/sdk#43763 to sortedBy
dart-lang/sdk#43763 is supposedly hard to fix in the language, but is a common gotcha when dealing with sortedBy, so the least we can do is at least alert users and tell them how to work around it.
Fixes https://github.com/dart-lang/collection/issues/271.
- [X] I’ve reviewed the contributor guide and applied the relevant portions to this PR.
Contribution guidelines:
- See our contributor guide for general expectations for PRs.
- Larger or significant changes should be discussed in an issue before creating a PR.
- Contributions to our repos should follow the Dart style guide and use
dart format. - Most changes should add an entry to the changelog and may need to rev the pubspec package version.
- Changes to packages require corresponding tests.
Note that many Dart repos have a weekly cadence for reviewing PRs - please allow for some latency before initial review feedback.
What it looks like:
I would prefer if this was handled in a more centralized way. https://github.com/dart-lang/sdk/issues/43763#issuecomment-1756007200
If we can't accomplish this in the analyzer we could work on the phrasing here.
I'm not at all wedded to this solution. Just witnessed myself and two other colleagues each independently (!) hit this error in the last few months and so went to document where it might be seen by others. I wasn't aware of https://github.com/dart-lang/sdk/issues/43763 until this morning (and managed to fumble my way to a solution in my code without finding it), but after reading https://github.com/dart-lang/sdk/issues/43763 and seeing it's supposedly a 10 year old issue with no easy fix, felt like documenting the failure to avoid others being confused by it could at least help. 🤷
Closing as the dart-lang/collection repository is merged into the dart-lang/core monorepo. Please re-open this PR there!