@@ -86,8 +86,12 @@ class _PassiveWebViewWidgetState extends State<PassiveWebViewWidget> {
86
86
@override
87
87
void initState () {
88
88
super .initState ();
89
- final props = widget.node.properties;
89
+ if (! isPlatformSupportedForWebView) {
90
+ print ('Unsupported platform: $defaultTargetPlatform for WebView.' );
91
+ return ;
92
+ }
90
93
94
+ final props = widget.node.properties;
91
95
if (kIsWeb) {
92
96
// WebView on web only supports loadRequest. Any other method invocation
93
97
// on the controller will result in an exception. Be aware!!
@@ -187,9 +191,7 @@ class _PassiveWebViewWidgetState extends State<PassiveWebViewWidget> {
187
191
188
192
Widget buildWebpageWebView (
189
193
BuildContext context, WebPageWebViewProperties properties) {
190
- if (! PassiveWebViewWidget .supportedPlatforms
191
- .contains (Theme .of (context).platform) &&
192
- ! kIsWeb) {
194
+ if (! isPlatformSupportedForWebView) {
193
195
return WebViewPreviewWidget (
194
196
icon: Icon (Icons .language_rounded),
195
197
node: widget.node,
@@ -213,9 +215,7 @@ class _PassiveWebViewWidgetState extends State<PassiveWebViewWidget> {
213
215
214
216
Widget buildGoogleMapsWebView (
215
217
BuildContext context, GoogleMapsWebViewProperties properties) {
216
- if (! PassiveWebViewWidget .supportedPlatforms
217
- .contains (Theme .of (context).platform) &&
218
- ! kIsWeb) {
218
+ if (! isPlatformSupportedForWebView) {
219
219
return WebViewPreviewWidget (
220
220
icon: Icon (Icons .map_outlined),
221
221
node: widget.node,
@@ -230,9 +230,7 @@ class _PassiveWebViewWidgetState extends State<PassiveWebViewWidget> {
230
230
231
231
Widget buildTwitterWebView (
232
232
BuildContext context, TwitterWebViewProperties properties) {
233
- if (! PassiveWebViewWidget .supportedPlatforms
234
- .contains (Theme .of (context).platform) &&
235
- ! kIsWeb) {
233
+ if (! isPlatformSupportedForWebView) {
236
234
return WebViewPreviewWidget (
237
235
icon: ImageIcon (
238
236
NetworkImage ('https://img.icons8.com/color/344/twitter--v2.png' )),
0 commit comments