UIP-3014 Warn when key uses default toString impl
Nobody has claimed this yet.
- Dominant language
- Dart
- Stars
- 432
- Forks
- 57
- PR merge metrics
- No merged PRs in 30d
Description
With key being dynamic and toString-ing values, it's easy to pass in any object.
It's also easy to pass in objects with non-unique toString implementations, such as the default Object.toString, and not notice that the value won't help when keying.
class Foo {
final bar;
Foo(this.bar);
}
..key = new Foo(1) // Uses "Instance of 'Foo'" as key
..key = new Foo(2) // Uses "Instance of 'Foo'" as key
We should check whether values like this are specified (perhaps via a regex, like ^Instance of '[_\$a-zA-Z0-9]+'$) and warn in the console.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Locate the key-handling entry point and the existing console-warning path, then reproduce the two Foo examples from the issue. The work is done when values using Dart's default object toString form trigger a console warning while other key values continue to work.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- dart
- Domain
- frontend
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100