url_launcher mailto 方案中的空格被转换为 + |颤动

问题描述 投票:0回答:2

我使用 url_launcher 包将邮件集成到 flutter 中。主题和正文作为查询参数给出。

 final Uri _emailLaunchUri = Uri(
                  scheme: 'mailto',
                  path: '[email protected]',
                  queryParameters: {
                      'body':
                          'this is sample text'
                    } 
                );

这将在邮件中显示为

this+is+sample+text
的文本。

flutter dart url-launcher
2个回答
19
投票

使用查询代替查询参数。

final Uri _emailLaunchUri = Uri(
                  scheme: 'mailto',
                  path: '[email protected]',
                  query:
                       'body=this is sample text',
                );

0
投票

将 + 转换为正文和主题中的间距。 启动此 _emailLaunchUri 时,将其设为 .toString(),然后使用 .replaceAll('+', '');将所有“+”替换为空格

© www.soinside.com 2019 - 2024. All rights reserved.