【问题标题】:E/flutter ( 3719): [ERROR:flutter/lib/ui/ui_dart_state.cc(199)] Unhandled Exception: Could not launch https://www.google.gr/?hl=elE/flutter(3719):[错误:flutter/lib/ui/ui_dart_state.cc(199)]未处理的异常:无法启动https://www.google.gr/?hl=el
【发布时间】:2021-06-01 19:14:02
【问题描述】:

单击FloatingActionButton 时出现错误。你能帮我吗? 当我按下物理设备上的按钮时,我的程序停止,我必须从调试工具中恢复它。 这是我的代码:

class _MyHomePageState extends State<MyHomePage> {
  
  @override
  Widget build(BuildContext context) {
    final mediaQuery = MediaQuery.of(context);
    final appbar = appbarBuilder();

    return Scaffold(
      appBar: appbar,
      body: body,
      floatingActionButton: FloatingActionButton(
        backgroundColor: Colors.blue,
        onPressed: () async {
          const url = 'https://www.google.gr/?hl=el';
          if (await canLaunch(url)) {
            await launch(url);
          } else {
            throw 'Could not launch $url';
          }
        },
        child: Image.asset(
          'assets/instagram.png',
          color: Colors.black,
        ),
      ),
    );
  }
}

【问题讨论】:

  • 您的设备无法启动 url,并抛出代码“Throw”中提到的异常
  • 是的,我知道,但我不知道为什么?

标签: flutter url-launcher


【解决方案1】:

你应该恢复你的模拟器..我遇到了这个问题,我只是恢复这个模拟器

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2021-08-24
    • 2019-07-21
    • 1970-01-01
    • 2021-02-28
    • 2021-03-15
    • 2020-06-07
    • 2022-08-20
    • 1970-01-01
    相关资源
    最近更新 更多