Posts

Showing posts with the label url_launcher

[Flutter tips] Easily send an email from your iOS and Android app (code included)

Image
When you design a mobile application, at some point, you will always need to propose the user a way to contact your or your support team. You can use different services or back-end, the most easy and fast way to achieve this functionality is to propose to the user to send you directly an email. Here are the steps to send an email. 1. Add package url_launcher In your yaml file: dependencies:   url_launcher: ^6.1.9 2. Use a correctly formatted link to send email In your controller, format your address like that, providing: - the recipient email address - and optionally a subject and a body    mailto :target@example.com? subject =Sujet& body =Contenu   3. Sample code import 'package:flutter/material.dart'; import 'package:url_launcher/url_launcher.dart'; class EmailExample extends StatelessWidget { final String email = 'destinataire@example.com'; final String subject = 'Mon Sujet PrĂ©-rempli'; final String body = 'Bonjour, voici un exempl...