findAncestorStateOfKey<T extends GlobalKey<State<StatefulComponent>>> method

  1. @override
T? findAncestorStateOfKey<T extends GlobalKey<State<StatefulComponent>>>(
  1. String key
)
override

Implementation

@override
T? findAncestorStateOfKey<T extends GlobalKey<State<StatefulComponent>>>(
    String key) {
  var ancestor = _parent;
  while (ancestor != null &&
      !(ancestor is StatefulBinding &&
          ancestor.state.key is T &&
          ancestor.state.key.key == key)) {
    ancestor = ancestor._parent;
  }
  return (ancestor as StatefulBinding?)?.state.key as T?;
}