我使用 url_launcher 包将邮件集成到 flutter 中。主题和正文作为查询参数给出。
final Uri _emailLaunchUri = Uri(
scheme: 'mailto',
path: '[email protected]',
queryParameters: {
'body':
'this is sample text'
}
);
这将在邮件中显示为
this+is+sample+text
的文本。
使用查询代替查询参数。
final Uri _emailLaunchUri = Uri(
scheme: 'mailto',
path: '[email protected]',
query:
'body=this is sample text',
);
将 + 转换为正文和主题中的间距。 启动此 _emailLaunchUri 时,将其设为 .toString(),然后使用 .replaceAll('+', '');将所有“+”替换为空格