-
Notifications
You must be signed in to change notification settings - Fork 29.7k
Change all occurrences of '$runtimeType#$hashCode' to use the describeIdentity #10888
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
Conversation
…use the idAndType method. (flutter#10871)" (flutter#10880)" This reverts commit ceb814a.
| import 'print.dart'; | ||
|
|
||
| /// Returns a 5 character long hexadecimal string generated from | ||
| /// Object.hashCode's 20 least-significant bits. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Object.hashCode should be hyperlinked (put square brackets around it)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
While you're here, it might be worth pointing to [descrimeIdentity] as well, either in a "See also" block, or just a separate paragraph that talks about their relationship.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
| } | ||
|
|
||
| /// Returns a summary of the runtime type and hash code of `object`. | ||
| String describeIdentity(Object object) => |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
style guide says not to split lines that use =>, so this should either be one line or have a block and an explicit return
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done. It would be nice if more of the places Flutter style diverges from Dart style could be upstreamed to the Dart style guide.
| return object.hashCode.toUnsigned(20).toRadixString(16).padLeft(5, '0'); | ||
| } | ||
|
|
||
| /// Returns a summary of the runtime type and hash code of `object`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
similarly maybe this should link to shortHash, and maybe instead of "runtime type" and "hash code" it should hyperlink to the actual members on Object.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done.
…eIdentity (flutter#10888) * Revert "Revert "Change all ocurrences of '$runtimeType#$hashCode' to use the idAndType method. (flutter#10871)" (flutter#10880)" This reverts commit ceb814a.
The describeIdentity method generates a shorter description with a consistent length consisting of the runtime type and the a 5 hex character long truncated version of the hash code.