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

问题描述

我使用 url_launcher 包在 Flutter 中集成了一个邮件到方案。主题和正文作为查询参数给出。

 final Uri _emailLaunchUri = Uri(
                  scheme: 'mailto',path: 'mail@qapp.how',queryParameters: {
                      'body':
                          'this is sample text'
                    } 
                );

这将在邮件中将文本显示this+is+sample+text

解决方法

使用 query 代替 queryParameters。

final Uri _emailLaunchUri = Uri(
                  scheme: 'mailto',path: 'mail@qapp.how',query:
                       'body=this is sample text',);