findAncestorOfExactType<T extends ChangeEmitter<Change>> method

  1. @protected
T findAncestorOfExactType<T extends ChangeEmitter<Change>>()

Implementation

@protected
T findAncestorOfExactType<T extends ChangeEmitter>() {
  var ancestor = parent;
  while (ancestor != null)
    if (ancestor.runtimeType == T)
      return ancestor;
    else
      ancestor = ancestor.parent;

  throw ('Could not find ancestor of type $T');
}