Flutter App- Send direct messages without saving number through WhatsApp
Flutter is a free and open-source mobile UI framework created by Google. It is cross platform that means a single code base can be used to make native Android and IOS apps.
Lets start making the WhatsApp Direct app which allows the user to send text messages directly without saving their number.
Using simple architecture here , it is a beginner friendly app and people with basic flutter knowledge can make this app.
Lets check the basic necessary installation before starting off.
For this run following which checks all the basic installation and return error if there is any.-
Next we create a project -
flutter create whatsapp_direct
As we have the skeleton of the project ready , Now lets start making the application.
Importing the packages we will using-
- intl_phone_number_input- It is simple flutter package for inputting phone number in international format.
- url_launcher: This plugin helps in launching url within app.
- splashscreen- This helps in making the first intro screen of the app.(This is not null safe package)
Also specify the image asset path in the pubspec.yaml file.
Run flutter pub get to install these packages after doing these changes in the pubspec file.
In flutter app , main.dart is the entry point in the app , it runs when app is initialized .
In the above code we are calling SplashScreenPage from the main.dart
In SplashScreenPage we import splashscreen Package which will help in creating a splash screen for the app.
From SplashScreenPage Home page is called after a specific time and in the mean time the app loads. (Here that time is 3 seconds).There are many options present in the splashscreen package and one can change those accordingly. The image and and the text can be changed that will be visible.
After the splash Screen we move to home page of the app. The logic is simple, we are using WhatsApp’s API which takes in phone number and message and just giving it a frontend application so that user can interact with it.
Below is the Source Code for the main logic and its implementation.
You have build a simple application from scratch that allows the user to send the messages on WhatsApp without saving number .
To publish this app on Google Play Store check this blog-https://rishabhsharma05.medium.com/publishing-a-flutter-app-on-play-store-616147806336
If someone has any doubt in the code , Please reach out to me in comments. Happy to Help.