Update the documentation of GlobalKey to explain why it is expensive (#62083)

This commit is contained in:
Remi Rousselet 2020-07-28 18:26:14 +01:00 committed by GitHub
parent b2c737547f
commit 50b7940b30
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -107,9 +107,13 @@ class ObjectKey extends LocalKey {
/// in the same animation frame in which it was removed from its old location in /// in the same animation frame in which it was removed from its old location in
/// the tree. /// the tree.
/// ///
/// Global keys are relatively expensive. If you don't need any of the features /// Reparenting an [Element] using a global key is relatively expensive, as
/// listed above, consider using a [Key], [ValueKey], [ObjectKey], or /// this operation will trigger a call to [State.deactivate] on the associated
/// [UniqueKey] instead. /// [State] and all of its descendants; then force all widgets that depends
/// on an [InheritedWidget] to rebuild.
///
/// If you don't need any of the features listed above, consider using a [Key],
/// [ValueKey], [ObjectKey], or [UniqueKey] instead.
/// ///
/// You cannot simultaneously include two widgets in the tree with the same /// You cannot simultaneously include two widgets in the tree with the same
/// global key. Attempting to do so will assert at runtime. /// global key. Attempting to do so will assert at runtime.