Issue with webview in flutter getting an error
[ERROR:flutter/shell/common/shell.cc(184)] Dart Error: Unhandled exception:
PlatformException(error, Trying to create a platform view of unregistered type: plugins.flutter.io/webview, null)
Issue with webview in flutter getting an error
[ERROR:flutter/shell/common/shell.cc(184)] Dart Error: Unhandled exception:
PlatformException(error, Trying to create a platform view of unregistered type: plugins.flutter.io/webview, null)
I had the same problem. But I did these steps, and it helped me:
<uses-permission android:name="android.permission.INTERNET" />
to the Android manifest:
android/app/src/main/AndroidManifest.xml
right above application tag.
<key>io.flutter.embedded_views_preview</key>
<string>YES</string>
in ios/Runner/Info.plist
http://www
)flutter clean
, delete build folder.I Faced this problem and solved it by changing the Android minSdkVersion= 16
to minSdkVersion= 20
you can find it in :
android > app > build.gradle
why minSdkVersion= 20
?
because I got the exception after using the plugin youtube_player_flutter
and in the documentation of the plugin they stated that you should use android minSdkVersion >= 20
, unfortunately flutter use by default minSdkVersion= 16
, thats why I got PlatformException
My Recommendation Dear reader is to look carefully at the plugins you are using and what version they are supporting on both Android and iOS
Thats all I know ...
Some Webview support minimumSdk package 21. Refresh the Project after changing minimumSdk
In iOS, you need to register plugins if they use native components.
To do this, you have to import FlutterPluginRegistrant in your project : https://flutter.dev/docs/development/add-to-app/ios/project-setup
import FlutterPluginRegistrant
After, you can use this line to register your plugins :
GeneratedPluginRegistrant.register(with: FlutterViewController)
⚠️ Be careful, you must to register your plugins once during the app lifecycle.
the webview_flutter version in pubspec.lock is different from pubspec.yaml,you can change the version in pubspec.lock and it will solved