flutterdarturl-launcher

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


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: 'mail@qapp.how',
                  queryParameters: {
                      'body':
                          'this is sample text'
                    } 
                );

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


Solution

  • instead of queryParameters use query.

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