title: How to fix Error: The method 'ancestorWidgetOfExactType' isn't defined for the class 'BuildContext'
body: <p>To solve this problem I searched but I found solution for 'inheritFromWidgetOfExactType' isn't defined for the class 'BuildContext' problem's solution. I can't find any solution for this problem The method 'ancestorWidgetOfExactType' isn't defined for the class 'BuildContext'.</p>
  <p>After Upgrading flutter 2.0.2 I got these errors after compiling my project</p>
  <pre><code>/C:/src/flutter/.pub-cache/hosted/pub.dartlang.org/pull_to_refresh-1.6.2/lib/src/smart_refresher.dart:273:21: Error: The method 'ancestorWidgetOfExactType' isn't defined for the class 'BuildContext'.
   - 'BuildContext' is from 'package:flutter/src/widgets/framework.dart' ('/C:/src/flutter/packages/flutter/lib/src/widgets/framework.dart').
  
  Try correcting the name to the name of an existing method, or defining a method named 'ancestorWidgetOfExactType'.
      return context?.ancestorWidgetOfExactType(SmartRefresher);
                      ^^^^^^^^^^^^^^^^^^^^^^^^^
  /C:/src/flutter/.pub-cache/hosted/pub.dartlang.org/pull_to_refresh-1.6.2/lib/src/smart_refresher.dart:277:21: Error: The method 'ancestorStateOfType' isn't defined for the class 'BuildContext'.
   - 'BuildContext' is from 'package:flutter/src/widgets/framework.dart' ('/C:/src/flutter/packages/flutter/lib/src/widgets/framework.dart').
  Try correcting the name to the name of an existing method, or defining a method named 'ancestorStateOfType'.
      return context?.ancestorStateOfType(TypeMatcher&lt;SmartRefresherState&gt;());
                      ^^^^^^^^^^^^^^^^^^^
  /C:/src/flutter/.pub-cache/hosted/pub.dartlang.org/pull_to_refresh-1.6.2/lib/src/smart_refresher.dart:988:20: Error: The method 'inheritFromWidgetOfExactType' isn't defined for the class 'BuildContext'.
   - 'BuildContext' is from 'package:flutter/src/widgets/framework.dart' ('/C:/src/flutter/packages/flutter/lib/src/widgets/framework.dart').
  Try correcting the name to the name of an existing method, or defining a method named 'inheritFromWidgetOfExactType'.
      return context.inheritFromWidgetOfExactType(RefreshConfiguration);
                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  
  /C:/src/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_staggered_animations-0.1.2/lib/src/animation_configuration.dart:161:20: Error: The method 'ancestorWidgetOfExactType' isn't defined for the class 'BuildContext'.
   - 'BuildContext' is from 'package:flutter/src/widgets/framework.dart' ('/C:/src/flutter/packages/flutter/lib/src/widgets/framework.dart').
  Try correcting the name to the name of an existing method, or defining a method named 'ancestorWidgetOfExactType'.
      return context.ancestorWidgetOfExactType(AnimationConfiguration)
                     ^^^^^^^^^^^^^^^^^^^^^^^^^
  /C:/src/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_staggered_animations-0.1.2/lib/src/animation_limiter.dart:75:20: Error: The method 'ancestorWidgetOfExactType' isn't defined for the class 'BuildContext'.
   - 'BuildContext' is from 'package:flutter/src/widgets/framework.dart' ('/C:/src/flutter/packages/flutter/lib/src/widgets/framework.dart').
  
  Try correcting the name to the name of an existing method, or defining a method named 'ancestorWidgetOfExactType'.
      return context.ancestorWidgetOfExactType(_AnimationLimiterProvider)
                     ^^^^^^^^^^^^^^^^^^^^^^^^^
  /C:/src/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_neumorphic-3.0.2/lib/src/widget/app_bar.dart:147:57: Error: No named parameter with the name 'nullOk'.
      final ScaffoldState scaffold = Scaffold.of(context, nullOk: true);
                                                          ^^^^^^
  /C:/src/flutter/packages/flutter/lib/src/material/scaffold.dart:1944:24: Context: Found this candidate, but the arguments don't match.
    static ScaffoldState of(BuildContext context) {
                         ^^
  2
  
  FAILURE: Build failed with an exception.
  
  * Where:
  Script 'C:\src\flutter\packages\flutter_tools\gradle\flutter.gradle' line: 991
  
  * What went wrong:
  Execution failed for task ':app:compileFlutterBuildDebug'.
  &gt; Process 'command 'C:\src\flutter\bin\flutter.bat'' finished with non-zero exit value 1
  
  * Try:
  Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
  
  * Get more help at https://help.gradle.org
  
  BUILD FAILED in 5m 31s
  Exception: Gradle task assembleDebug failed with exit code 1
  </code></pre>
  <p>This is my Flutter Doctor</p>
  <pre><code>Doctor summary (to see all details, run flutter doctor -v):
  [√] Flutter (Channel stable, 2.0.2, on Microsoft Windows [Version 10.0.19042.867], locale en-US)
  [√] Android toolchain - develop for Android devices (Android SDK version 30.0.3)
  [X] Chrome - develop for the web (Cannot find Chrome executable at .\Google\Chrome\Application\chrome.exe)
      ! Cannot find Chrome. Try setting CHROME_EXECUTABLE to a Chrome executable.
  [√] Android Studio (version 4.1.0)
  [√] VS Code (version 1.54.2)
  [√] Connected device (2 available)
  </code></pre>