Error:
- '_WebViewAppState' is from 'package:webviewmyhospitalnow/main.dart' ('lib/main.dart').
Try correcting the name to the name of an existing method, or defining a method named 'InAppWebView'.
body: InAppWebView(
^^^^^^^^^^^^
lib/main.dart:33:28: Error: The method 'URLRequest' isn't defined for the class '_WebViewAppState'.
- '_WebViewAppState' is from 'package:webviewmyhospitalnow/main.dart' ('lib/main.dart').
Try correcting the name to the name of an existing method, or defining a method named 'URLRequest'.
initialUrlRequest: URLRequest(url: Uri.parse("https://www.myhospitalnow.com/hospitals/")),
^^^^^^^^^^
lib/main.dart:49:11: Error: The method 'JavascriptChannel' isn't defined for the class '_WebViewAppState'.
- '_WebViewAppState' is from 'package:webviewmyhospitalnow/main.dart' ('lib/main.dart').
Try correcting the name to the name of an existing method, or defining a method named 'JavascriptChannel'.
JavascriptChannel(
^^^^^^^^^^^^^^^^^
lib/main.dart:39:19: Error: The method 'evaluateJavascript' isn't defined for the class 'Object?'.
- 'Object' is from 'dart:core'.
Try correcting the name to the name of an existing method, or defining a method named 'evaluateJavascript'.
value.evaluateJavascript(source: '''
^^^^^^^^^^^^^^^^^^
lib/main.dart:67:15: Error: The method 'evaluateJavascript' isn't defined for the class 'Object?'.
- 'Object' is from 'dart:core'.
Try correcting the name to the name of an existing method, or defining a method named 'evaluateJavascript'.
value.evaluateJavascript(source: '''
^^^^^^^^^^^^^^^^^^
Solution:
The reason for the error message “Couldn’t resolve the package ‘flutter_inappwebview’” could be that the package hasn’t been fetched or added to your pubspec.yaml file.
First, confirm that the flutter_inappwebview package is included to the requirements section of your pubspec.yaml file:
dependencies:
flutter_inappwebview: ^5.3.2
Use the command flutter pub get in your terminal to fetch the package after adding it to your pubspec.yaml file.
Try using the package’s git version as advised in 1 if the issue still doesn’t go away:
dependencies:
flutter_inappwebview:
git:
url: https://github.com/pichillilorenzo/flutter_inappwebview.git
After updating the pubspec.yaml file, remember to run flutter pub get again.
If none of these solutions work, it could be due to an issue with your Flutter installation or IDE setup. Try restarting your IDE and running flutter doctor to diagnose any potential issues