currentState property

T? get currentState

Retrieves the current State associated with the widget registered with this key.

Implementation

T? get currentState {
  final element = _registry[this];
  if (element is StatefulElement) {
    return element.state as T?;
  }
  return null;
}