Henry
Henry

Reputation: 379

Flutter App Communicates With Device Built-in Apps

I'd like to enable my Flutter App to allow users to get redirected to another app on the phone, like Phone or Mail apps on both Android and IOS.

When they click on:

 a phone number => open the Phone app with the number passed into the app.
 an email => open the Mail app with the email address passed into the app.

Is this possible? if so what widgets/plug-ins to use?

Upvotes: 0

Views: 432

Answers (1)

anmol.majhail
anmol.majhail

Reputation: 51316

You can Use this Package : https://pub.dartlang.org/packages/url_launcher

_launchDialer() async {
  const url = 'tel:12345678';
  if (await canLaunch(url)) {
    await launch(url);
  } else {
    throw 'Could not launch $url';
  }
}

_launchEmailApp() async {
  const url = 'mailto:smith@example.org?subject=News&body=New%20plugin';
  if (await canLaunch(url)) {
    await launch(url);
  } else {
    throw 'Could not launch $url';
  }
}

Upvotes: 1

Related Questions