GlobalObjectStateKey<T extends State<StatefulComponent>> class

A global state key that takes its identity from the object used as its value.

Used to tie the identity of a component to the identity of an object used to generate that component.

If the object is not private, then it is possible that collisions will occur where independent components will reuse the same object as their GlobalObjectStateKey value in a different part of the tree, leading to a global key conflict. To avoid this problem, create a private GlobalObjectStateKey subclass, as in:

class _MyKey extends GlobalObjectStateKey {
  const _MyKey(Object value) : super(value);
}

Since the runtimeType of the key is part of its identity, this will prevent clashes with other GlobalObjectStateKeys even if they have the same value.

Any GlobalObjectStateKey created for the same value will match.

Inheritance
Annotations

Constructors

GlobalObjectStateKey.new(Object value)
Creates a global key that uses identical on value for its operator==.
const

Properties

currentComponent Component?
The component in the tree that currently has this global key.
no setterinherited
currentContext BuildContext?
The build context in which the component with this key builds.
no setterinherited
currentState → T?
The State for the component in the tree that currently has this global key.
no setterinherited
hashCode int
The hash code for this object.
no setteroverride
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
value Object
The object whose identity is used by this key's operator==.
final

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
override

Operators

operator ==(Object other) bool
The equality operator.
override