email function

void email(
  1. String email,
  2. String subject
)

Implementation

void email(final String email, final String subject) {
  String? encodeQueryParameters(
    final Map<String, String> params,
  ) =>
      params.entries
          .map(
            (final MapEntry<String, String> e) => '${Uri.encodeComponent(e.key)}=${Uri.encodeComponent(e.value)}',
          )
          .join('&');

  final Uri emailLaunchUri = Uri(
    scheme: 'mailto',
    path: email,
    query: encodeQueryParameters(<String, String>{
      'subject': subject,
    }),
  );

  launchURL(emailLaunchUri.toString());
}