title: Why findAncestorWidgetOfExactType is O(N) and dependOnInheritedWidgetOfExactType is O(1)
body: <p>in Flutter there are two functions : </p>
  
  <ul>
  <li><strong>findAncestorWidgetOfExactType</strong></li>
  <li><strong>dependOnInheritedWidgetOfExactType</strong></li>
  </ul>
  
  <p>in the docs they say that: <em>findAncestorWidgetOfExactType</em> is relatively expensive (<strong>O(N)</strong> in the depth of the tree).</p>
  
  <p>and <em>dependOnInheritedWidgetOfExactType</em> is <strong>O(1)</strong> with a small constant factor.</p>
  
  <p>anyone can explain why ? why the first one is more expensive than the other ?</p>
  
  <p>Thanks</p>