0

how to open a contact or phone call or keypad menu using dart in flutter inside the icon button inside onPressed?

enter image description here

new IconButton(icon: new Icon(Icons.call, color: Colors.blue,), onPressed: null),

Thanks.

Günter Zöchbauer
  • 623,577
  • 216
  • 2,003
  • 1,567
Sandy Rizky
  • 163
  • 2
  • 14
  • 1
    There is currently nothing in Flutter. I don't know Android well enough if something like that can be achieved with intents, but in Flutter you can use https://pub.dartlang.org/packages/contacts_service#-readme-tab- to show your own contacts dialog, or otherwise https://github.com/flutter/plugins/tree/master/packages/android_intent – Günter Zöchbauer Mar 05 '18 at 11:06
  • 1
    Yeah if you want to show the system contacts app, you'd need to launch a new intent, using the methods @GünterZöchbauer already linked to. – Dan Field Mar 05 '18 at 14:31
  • Does this answer your question? [How can I dial the phone from Flutter?](https://stackoverflow.com/questions/43149073/how-can-i-dial-the-phone-from-flutter) – Shady Boshra Mar 30 '20 at 11:15

1 Answers1

0

As Rajesh Jr. answer:

This method will open the dialer :

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

EDIT:

In case anybody facing errors:

Add url_launcher: in the pubspec.yaml & run flutter get

Also import 'package:url_launcher/url_launcher.dart';

Shady Boshra
  • 2,521
  • 3
  • 23
  • 35