Search Inbox Messages - Flutter SMS Retriever 2
Last updated Mar 26, 2021In last article Read Inbox Messages we learned how to read all Messages from inbox in Flutter. This part II we are going to learn how you can retrieve Messages from inbox for a particular number in Flutter. Search Inbox messages based on Number,Message...
For this we are going to use SMS plugin.
Let's get started
Read Phone Contacts in Flutter Application
Step 1: Open the last flutter application or Create flutter application
Step 2: Add dependencies or update to the latest version add SMS dependencies in pubspec.yaml file and run flutter pub get on terminal
dependencies: |
Step 3: Create dart file and add below code
Referring to the previous source code of the article replace the messages = await query.getAllSms; by
fetchSMS() async { messages = await query.querySms(address:"+256256899001"); } }
|
Add import 'package: sms/sms.dart';
To handle the SMS we need to create instance of SmsQuery
Step 4: Add below code for the search option in the list of messages
class SearchBarDelegate extends SearchDelegate { |
Step 5: Run application
Article Contributed By :
|
|
|
|
874 Views |