首页 > 解决方案 > 我如何从这个 url 中得到一个 uri,就像 dart 中的这种格式一样?

问题描述

编辑:添加到我需要从此 url 中获取 uri 的问题:

https://us-central1-cam.cloudfunctions.net/create

通常我使用 Uri.parse 或 Uri.https,但由于 us-central1-cam 两者都不起作用(我认为)。在主机 cloudfunctions.net 之前。这种格式有没有机会命名?语言是飞镖。API 需要的类型是包含字符串的映射,如果没有路径,则为单个字符串。

这是我的代码:

'''

 onTap: () async {
                  final parameters = {
                    "response_type": "code",
                    "client_id":
                        "57",
                    "redirect_uri": {
                  Uri.encodeComponent(
                      "https://us-central1-41915.cloudfunctions.net"),
                  "/create",
                },
                    ),
                    "state": "heo5jt,9wv5jDRANCWX,kdrjghgyqw.c/w,",
                    "scope": "wallet:accounts:create,"
                        "wallet:addresses:create,"
                        "wallet:transactions:request",
                  };
                  final uri = Uri.https(
                      "www.coinbase.com", "/oauth/authorize", parameters);
                  print(uri);
                  final response = await http.get(uri);
                  print(response.body);
                },

''' 错误是 API 不接受它。但是,此语法有效(但不是正确的页面,仅用于测试): '''"redirect_uri": { "https://1x1.photo", "/home", },'''

标签: flutterdartgoogle-cloud-functionsdart-http

解决方案


推荐阅读