Small details that build taste in Flutter.

curated by Kamran BekirovKamran Bekirov

Open the email composer inside the app

An "Email us" button usually kicks the user out of the app, into the mail app, and they have to find their way back. On iOS this is avoidable. The system mail composer can open inside your app as a sheet. The user writes, taps send, and is still where they were.

flutter_email_sender does exactly that. On iOS it opens the native composer inside the app. On Android it opens the email app, with a picker when several are installed.

Pre-fill the recipient and the subject, so the only thing left to type is the message:

abstract final class ContactSupport {
  static Future<void> open(BuildContext context) async {
    try {
      await FlutterEmailSender.send(
        Email(
          recipients: ['kamran@bunpod.app'],
          subject: 'Found a Bug',
        ),
      );
    } on FlutterEmailSenderNotAvailableException {
      showSnackBar(
        context: context,
        message: 'No mail app. Write to kamran@bunpod.app',
      );
    }
  }
}

The catch part matters. With no mail account on the device, the plugin throws. Show your address then, so the user can copy it into whatever they use.

Kamran Bekirov
Kamran Bekirov

Want this level of care in your Flutter apps?

Work With Me