White space get converted to + in url_launcher mailto scheme | Flutter

1.2k Views Asked by At

I had integrated a mail to scheme in flutter using a url_launcher package. the subject and body were given as query parameters.

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

This will give the text as this+is+sample+text in mail.

1

There are 1 best solutions below

1
On BEST ANSWER

instead of queryParameters use query.

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