Flutter 颤振Url启动器不';不要把全文传给短信
我正在尝试发送一条带有flatter中的包url启动器的sms消息。当我按下按钮时:仅此信息出现在短信正文中(安卓手机上): 但是“文本”有点长。有解决办法吗?谢谢Flutter 颤振Url启动器不';不要把全文传给短信,flutter,dart,Flutter,Dart,我正在尝试发送一条带有flatter中的包url启动器的sms消息。当我按下按钮时:仅此信息出现在短信正文中(安卓手机上): 但是“文本”有点长。有解决办法吗?谢谢 RaisedButton( onPressed: () { launch( 'sms:000000000?body=https://www.google.com/maps/dir/?api=1&destination=47.7
RaisedButton(
onPressed: () {
launch(
'sms:000000000?body=https://www.google.com/maps/dir/?api=1&destination=47.751076,-120.740135');
},
我测试了没有“&”符号的链接。而不是通过一切。是否有使用&symbol的选项?您需要对URL中的特殊字符使用URL编码 所以
&
等于%26
这会奏效的
launch('sms:000000000?body=https://www.google.com/maps/dir/?api=1%26destination=47.751076,-120.740135');
另一种方法是编码并通过Uri.encodeFull(urlString)
或Uri.encodeComponent(urlString)
像这样
launch("sms:" + Uri.encodeComponent('000000000?body=https://www.google.com/maps/dir/?api=1&destination=47.751076,-120.740135'));
您需要对URL中的特殊字符使用URL编码 所以
&
等于%26
这会奏效的
launch('sms:000000000?body=https://www.google.com/maps/dir/?api=1%26destination=47.751076,-120.740135');
另一种方法是编码并通过Uri.encodeFull(urlString)
或Uri.encodeComponent(urlString)
像这样
launch("sms:" + Uri.encodeComponent('000000000?body=https://www.google.com/maps/dir/?api=1&destination=47.751076,-120.740135'));