You can do it by two ways:-
url_launcher package will be used to implement phone call using the default app of your mobile phone. This package will auto direct the phone to the default phone call making app and open the dialer screen to make the call.
flutter_phone_direct_caller package is not the best package but we can implement direct phone calls directly from our phone without the intermediate dialer.
Install the following dependencies inside your pubspec.yaml file:
dependencies:
flutter:
sdk: flutter
cupertino_icons: ^1.0.0
flutter_phone_direct_caller: ^1.0.1
url_launcher: ^5.7.10
Making Phone Calls using the "flutter_phone_direct_caller" : plugin
To implement the phone call using this plugin is really very easy. This package provides us FlutterPhoneDirectCaller class that provides us callNumber() method that takes a phone number.
_callNumber(String phoneNumber) async {
String number = phoneNumber;
await FlutterPhoneDirectCaller.callNumber(number);
}
You can implement it in your button as follows
RaisedButton(
child: Text("Call"),
onPressed: () {
_callNumber(textEditingController.text);
},
)
Making Phone Calls using the "url_launcher": plugin
This package provides us launch(URL) method that takes an URL with schema. Scheme is very essential as it directs the URL. In the case of phone calls, we use ‘tel:’ schema.
_launchPhoneURL(String phoneNumber) async {
String url = 'tel:' + phoneNumber;
if (await canLaunch(url)) {
await launch(url);
} else {
throw 'Could not launch $url';
}
}
and to raised button:-
RaisedButton(
child: Text("Call"),
onPressed: () {
_launchPhoneURL(textEditingController.text);
},
)
IF you need advanced features you can use "flutter_voip_kit", it is very new library, I have also not used it but it looks promising at first galance..