How To Make Phone Calls and Send SMS Messages On Your Flutter App
This tutorial is an expansion of How To Access Contacts On Your Flutter App. If you do not already have access to your phones contacts in a flutter app, please refer the tutorial mentioned above first.
However you can modify the code mentioned below to manually input a number instead of using your devices contacts.
Use Cases
- Call users from your app
- Send SMS messages
- Send bulk SMS messages
- Send your contacts a direct link to download your app
- Share a direct link to a page on your app via SMS
Getting Started
For this tutorial we are going to use the flutter_sms(2.0.0) package to send SMS messages using the operating system SMS application. We use url_launcher(5.4.2) package to make phone calls from our flutter application. Import these packages into your pubspec.yaml
file.
dependencies:
flutter_sms: ^2.0.0
url_launcher: ^5.4.2
Get Valid Phone Number
First we need to check whether our contact has a valid phone number. The Contacts
object has field phones
which is an Iterable<Item>
.