简体   繁体   English

在颤振应用程序中实现 Web 视图时出错

[英]Getting error while implementing web-view in flutter applications

I am building a flutter app that has a web-view.我正在构建一个具有网络视图的颤振应用程序。 I have updated the minsdkversion to 20. and added the android permission to use the internet but still getting the errror.我已将 minsdkversion 更新为 20。并添加了使用互联网的 android 权限,但仍然出现错误。 click here to view error点击这里查看错误

DART


import 'package:flutter/material.dart';
import 'package:webview_flutter/webview_flutter.dart';

void main() {
  runApp(
    const MaterialApp(
      home: WebViewApp(),
    ),
  );
}

class WebViewApp extends StatefulWidget {
  const WebViewApp({Key? key}) : super(key: key);

  @override
  State<WebViewApp> createState() => _WebViewAppState();
}

class _WebViewAppState extends State<WebViewApp> {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: const Text('Flutter WebView'),
      ),
      body: const WebView(
        initialUrl: 'https://flutter.dev',
      ),
    );
  }
}

I ran your code into my machine it works fine on android devices.我将您的代码运行到我的机器上,它在 android 设备上运行良好。 I hope you are running your app on an android or ios device because flutter_webview: any version supports only Android and ios devices as per the official doc.我希望您在 android 或 ios 设备上运行您的应用程序,因为flutter_webview: any版本仅支持 Android 和 ios 设备。看到这张图片

you are using webview_flutter that support platform Android and iOS, but you trying to run on web, that's why this error occurs.您正在使用支持 Android 和 iOS 平台的webview_flutter ,但您尝试在网络上运行,这就是发生此错误的原因。

Thanks,谢谢,

Happy Codding!快乐编码!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM