Skip to content

Conversation

@jacob314
Copy link
Contributor

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.

@jacob314 jacob314 requested a review from Hixie June 21, 2017 15:34
import 'print.dart';

/// Returns a 5 character long hexadecimal string generated from
/// Object.hashCode's 20 least-significant bits.
Copy link
Contributor

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)

Copy link
Contributor

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.

Copy link
Contributor Author

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) =>
Copy link
Contributor

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

Copy link
Contributor Author

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`.
Copy link
Contributor

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.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done.

@Hixie
Copy link
Contributor

Hixie commented Jun 21, 2017

LGTM

@jacob314 jacob314 merged commit 595cd23 into flutter:master Jun 21, 2017
@jacob314 jacob314 deleted the revert_revert branch June 21, 2017 17:47
gspencergoog pushed a commit to gspencergoog/flutter that referenced this pull request Jul 1, 2017
…eIdentity (flutter#10888)

* Revert "Revert "Change all ocurrences of '$runtimeType#$hashCode' to use the idAndType method. (flutter#10871)" (flutter#10880)"

This reverts commit ceb814a.
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 13, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants