使用 URL Launcher Plugin 时从 Firestore 调用 URL

问题描述

我正在使用 url_launcher plugin 并希望从 Firestore 集合中调用 URL,而不是将其硬编码到应用程序中。

我尝试了很多方法来做到这一点(Streambuilder 等...)但都无济于事。在一个非常简单的示例中,使用下面的标准 url_launcher 示例代码,如何实现?

void main() {
  runApp(Scaffold(
    body: Center(
      child: RaisedButton(
        onPressed: _launchURL,child: Text('Show Flutter homepage'),),));
}

_launchURL() async {
  const url = 'https://flutter.dev'; // HERE IS WHERE I WANT TO CALL THE URL FROM FIRESTORE
  if (await canLaunch(url)) {
    await launch(url);
  } else {
    throw 'Could not launch $url';
  }
}

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)