GlobalObjectKey< T extends State< StatefulWidget>> class
A global key that takes its identity from the object used as its value.
Used to tie the identity of a widget to the identity of an object used to generate that widget.
If the object is not private, then it is possible that collisions will occur where independent widgets will reuse the same object as their GlobalObjectKey value in a different part of the tree, leading to a global key conflict. To avoid this problem, create a private GlobalObjectKey subclass, as in:
class _MyKey extends GlobalObjectKey {
const _MyKey(Object value) : super(value);
}
Since the runtimeType of the key is part of its identity, this will prevent clashes with other GlobalObjectKeys even if they have the same value.
Any GlobalObjectKey created for the same value will match.
Constructors
- GlobalObjectKey(Object value)
-
Creates a global key that uses identical on
value
for its operator==.const
Properties
- hashCode → int
-
The hash code for this object. [...]
read-only, override
- value → Object
-
The object whose identity is used by this key's operator==.
final
- currentContext → BuildContext
-
The build context in which the widget with this key builds. [...]
read-only, inherited
- currentState → T
-
The State for the widget in the tree that currently has this global key. [...]
read-only, inherited
- currentWidget → Widget
-
The widget in the tree that currently has this global key. [...]
read-only, inherited
- runtimeType → Type
-
A representation of the runtime type of the object.
read-only, inherited
Methods
-
toString(
) → String -
Returns a string representation of this object.
override
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a non-existent method or property is accessed. [...]
inherited
Operators
-
operator ==(
dynamic other) → bool -
The equality operator. [...]
override