Add flutter_inappwebview as a dependency in your pubspec.yaml file.

If you’re running an application and need to access the binary messenger before runApp() has been called (for example, during plugin initialization), then you need to explicitly call the WidgetsFlutterBinding.ensureInitialized() first.

An example:

void main() {
  // it should be the first line in main method
  WidgetsFlutterBinding.ensureInitialized();

  // rest of your app code
  runApp(MyApp());
}

Requirements

  • Dart sdk: “>=2.12.0-0 <3.0.0”
  • Flutter: “>=1.22.2”
  • Android: minSdkVersion 17 and add support for androidx (see AndroidX Migration to migrate an existing app)
  • iOS: --ios-language swift, Xcode version >= 12