Error:
* Where:
Script 'C:\flutter\packages\flutter_tools\gradle\src\main\groovy\flutter.groovy' line: 1350
* What went wrong:
Execution failed for task ':app:compileFlutterBuildDebug'.
> Process 'command 'C:\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 36s
Exception: Gradle task assembleDebug failed with exit code 1
Solution:
It appears from the error messages that there is a lack of recognition for the JavaScriptChannel and JavaScriptMessage types. Changes in the API of the flutter_inappwebview package may be the cause of this.
The addJavaScriptHandler method 2 has superseded the JavaScriptChannel and JavaScriptMessage classes, according to the official flutter_inappwebview documentation.
This is how to change your code:
And in your HTML/JS code, you would call this handler like this:
window.flutter_inappwebview._callHandler('flutter_inappwebview', 'pickFile');
Please take note that the handler is called from JavaScript using the flutter_inappwebview._callHandler method. Additionally, don’t forget to include the appropriate package to the top of your main.dart file:
import 'package:flutter_inappwebview/flutter_inappwebview.dart';
Verify that the flutter_inappwebview package is the most recent version in your pubspec.yaml file. Your current version of pubspec.yaml indicates that you are using 5.5.0. If it isn’t the most recent version, kindly update it.