flutter - 我如何从这个 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", },'''
解决方案
推荐阅读
- javascript - 合并3个数组并在lodash中加入字段?
- javascript - 使用 setAttribute 添加自定义外观控制
- intellij-idea - 想法,如何显示“引入局部变量”?
- java - Java 反射 - 使用接受接口作为参数的公共构造函数调用受保护的类
- arrays - swift - 使用协议投射 Array 与 ArraySlice
- java - 错误没有指定运行程序并且在类路径上找不到 DirectRunner
- swift4 - Swift4:为什么以及何时同时访问单独的结构元素是非法的?
- elasticsearch - ElasticSearch 6.4.2 错误:未知设置 [path.conf]
- xamarin - Xamarin 滚动视图在网格末尾显示空白
- android - 我的项目没有拾取库模块 jar 文件夹中定义的类文件