Building A Basic SMS App Using Flutter - Part 1

AuthorMayank Bajaj (Software Engineer)21st Oct 2018 . 4 min read time

Flutter Development Service

Flutter is an open-source mobile application development framework created by Google. It is used to develop native mobile applications for Android and iOS. Basically, it's a framework which allows you to write a single code which works on both mobile platforms.

Getting Started!

You can install the flutter SDK from here. Choosing Android Studio or IntelliJ as your development tool is totally your choice.

Let's get started, create a simple templated Flutter app, using the instructions in Getting Started with your first Flutter app.

Use an external package

In this step, you’ll start using an open-source package named sms, which allows you to send, receive, query SMS messages, SMS delivery, and query contacts info. It exposes an easy to use and friendly set of API for developing a completely functional SMS app in Flutter.

You can find the sms package, as well as many other open source packages, on

The pubspec file manages the assets for a Flutter app. In pubspec.yaml, append sms: ^0.2.0 to the dependencies list as below:

    sdk: flutter
  sms: ^0.2.0   # add this line

Further run flutter packages get in the console. This pulls the package into your project. You should see the following in the console:

flutter packages get Running "flutter packages get" in app_name... Process finished with exit code 0

In lib/main.dart, import the new package:

import 'package:sms/sms.dart';

Querying SMS messages

SmsQuery query = new SmsQuery();

It creates an instance of the SmsQuery class.

Getting all SMS messages

List messages = await query.getAllSms;

Flutter uses Dart which is also developed by Google. Dart is a single-threaded programming language which helps you write non-blocking code hence if you won't write await, it will not wait for the line to execute and move to the next line. Await here waits for the instruction to be completed, before going to the new line. Also for using await in the code, you need to import the async package from dart.

import 'dart:async';

Once the above SmSQuery statement executes, the result is stored in the messages variable of type List.

You can try this sample code and log the value of messages, you will see all the message objects are logged in to the console.

In the next blog, we would look into How to listen for incoming messages in Flutter.


6 min

Building a Facebook Echo-Bot in Python

Gartner estimates that by 2020, chatbots will be handling 85 percent of customer-service interactions; they are already handling about 30 percent of transactions now.

View Article
3 min

How to Send an Email from Flutter - SMS App Part 3

In this blog, we will see how we can send emails from our flutter application using mailgun credentials. This post is in continuation of the Flutter SMS app series.

View Article
4 min

How To Listen for SMS using Flutter - SMS App Part 2

In continuation with the previous blog, we would continue to build our new basic SMS app using Flutter. In this blog, we would see how we can add the functionality of listening for incoming SMS messages on the device.

View Article

contact us

Sent!You are a bot!?