Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

1.3K
Views
How can I dial the phone from Flutter?

I am building a Flutter app, and I'd like to dial a phone number in response to a button tap. What's the best way to do this?

Thanks!

over 4 years ago · Santiago Trujillo
3 answers
Answer question

0

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';

over 4 years ago · Santiago Trujillo Report

0

Typically, to interact with the underlying platform, you have to write platform specific code and communicate with the same using platform channels. However, Flutter provides some points of integration with the platform out of the box. To dial the phone for instance, you can use the UrlLauncher.launch API with the tel scheme to dial the phone.

Something like UrlLauncher.launch("tel://<phone_number>"); should work fine on all platforms.

Do note that this will not work in the simulators. So make sure you are using an actual device to test this.

over 4 years ago · Santiago Trujillo Report

0

You can use the url_launcher widget (https://pub.dev/packages/url_launcher)

  1. Add this to your package's pubspec.yaml file: dependencies: url_launcher: ^5.7.10

  2. Install it: $ flutter pub get

  3. Import it import 'package:url_launcher/url_launcher.dart';

  4. Inside your class, define this method so you can call from any action in your code:

     Future<void> _makePhoneCall(String url) async {
     if (await canLaunch(url)) {
       await launch(url);
     } else {
       throw 'Could not launch $url';
     }
    

    }

  5. inside the build widget:

     IconButton(icon: new Icon(Icons.phone),
        onPressed: () 
        {
           setState(() {
              _makePhoneCall('tel:0597924917');
           });
        },
      ),
    

Note 1: you should write the phone number with prefix 'tel': 'tel:0123456789'

Note 2: sometimes it will not work well until you close the app in your mobile and reopen it, so flutter can inject the code of the new widget successfully.

over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!