Skip to content
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

feat: Make Component.key public #2988

Merged
merged 2 commits into from Jan 22, 2024
Merged

feat: Make Component.key public #2988

merged 2 commits into from Jan 22, 2024

Conversation

spydon
Copy link
Member

@spydon spydon commented Jan 21, 2024

Description

Since the user might want to use the ComponentKey after it has been assigned it should be made public.

It also updates Consumer.key to Consumer.widgetKey in flame_riverpod to avoid a name clash. (Slightly breaking)

Checklist

  • I have followed the Contributor Guide when preparing my PR.
  • I have updated/added tests for ALL new/updated/fixed functionality.
  • I have updated/added relevant documentation in docs and added dartdoc comments with ///.
  • I have updated/added relevant examples in examples or docs.

Breaking Change?

  • Yes, this PR is a breaking change.
  • No, this PR is not a breaking change.

Migration instructions

If you are using consumer.key from flame_riverpod you have to now use consumer.widgetKey instead.

Related Issues

Closes #2985

@@ -989,7 +988,7 @@ class Component {
/// A key that can be used to identify this component in the tree.
///
/// It can be used to retrieve this component from anywhere in the tree.
final ComponentKey? _key;
final ComponentKey? key;
Copy link
Member

Choose a reason for hiding this comment

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

I wonder if we should call it componentKey for the same reason you have exposed; it is possible other people are using key for something else on their components, and this would clash. no strong opinion though

Copy link
Member Author

@spydon spydon Jan 21, 2024

Choose a reason for hiding this comment

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

I think it is rare enough, I've never seen it anywhere else except in the very new flame_riverpod version

Copy link
Member

@luanpotter luanpotter left a comment

Choose a reason for hiding this comment

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

LGTM

@spydon spydon merged commit 7fbd5af into main Jan 22, 2024
11 checks passed
@spydon spydon deleted the feat/public-component-key branch January 22, 2024 09:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

getter for ComponentKey on Component itself
3 participants