smsfetcher 1.0.0

  • Readme
  • Changelog
  • Example
  • Installing
  • 71

SMS FETCHER #

An Open Source Flutter Package that makes retrieving of SMS easier from your android phone.

Note: #

flutter_sms_fetcher doesn't support iOS due to Apple's Privacy Concerns. See link for more info: link

Usage #

Add the following permissions to your AndroidManifest.xml file

<uses-permission android:name="android.permission.READ_SMS"/>

Example #

import 'dart:async';

import 'package:flutter/services.dart';
import 'package:smsfetcher/smsfetcher.dart';

void main() {
  runApp(MyApp());
}

class MyApp extends StatefulWidget {
  @override
  _MyAppState createState() => _MyAppState();
}

class _MyAppState extends State<MyApp> {
  List<Sms> _smsList;


  Future<void> fetchSms() async {
    List<Sms> smsList;
    try {
      smsList = await Smsfetcher.getSms();
    }on PlatformException{
      print("Error");
    }
    setState(() {
      _smsList = smsList;
    });
  }

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(
          title: const Text('Sms Fetcher'),
        ),
        body: Center(
          child: Column(
            children: <Widget>[
              Text('$_smsList'),
              RaisedButton(
                onPressed: (){
                  fetchSms();
                },
                child: Text("Fetch sms"),
                color: Colors.orange,
              )
            ],
          ),
        ),
      ),
    );
  }
}

Contributors #

Josteve Adekanbi and Momoh Hero

Changelog #

1.0.0 #

Package Initialization

  • Includes SMSFetcher - That retrieves a list of SMS from your android phone

example/lib/main.dart

import 'package:flutter/material.dart';
import 'dart:async';

import 'package:flutter/services.dart';
import 'package:smsfetcher/smsfetcher.dart';

void main() {
  runApp(MyApp());
}

class MyApp extends StatefulWidget {
  @override
  _MyAppState createState() => _MyAppState();
}

class _MyAppState extends State<MyApp> {
  List<Sms> _smsList;


  Future<void> fetchSms() async {
    List<Sms> smsList;
    try {
      smsList = await Smsfetcher.getSms();
    }on PlatformException{
      print("Error");
    }
    setState(() {
      _smsList = smsList;
    });
  }

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(
          title: const Text('Sms Fetcher'),
        ),
        body: Center(
          child: Column(
            children: <Widget>[
              Text('$_smsList'),
              RaisedButton(
                onPressed: (){
                  fetchSms();
                },
                child: Text("Fetch sms"),
                color: Colors.orange,
              )
            ],
          ),
        ),
      ),
    );
  }
}

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:


dependencies:
  smsfetcher: ^1.0.0

2. Install it

You can install packages from the command line:

with Flutter:


$ flutter pub get

Alternatively, your editor might support flutter pub get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:


import 'package:smsfetcher/smsfetcher.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
43
Health:
Code health derived from static analysis. [more]
99
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
100
Overall:
Weighted score of the above. [more]
71
Learn more about scoring.

We analyzed this package on May 30, 2020, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.8.2
  • pana: 0.13.8-dev
  • Flutter: 1.17.1

Health issues and suggestions

Document public APIs. (-1 points)

12 out of 12 API elements have no dartdoc comment.Providing good documentation for libraries, classes, functions, and other API elements improves code readability and helps developers find and use your API.

Format lib/smsfetcher.dart.

Run flutter format to format lib/smsfetcher.dart.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.1.0 <3.0.0
flutter 0.0.0
permission ^0.1.7 0.1.7
Transitive dependencies
collection 1.14.12
meta 1.1.8
sky_engine 0.0.99
typed_data 1.1.6
vector_math 2.0.8
Dev dependencies
flutter_test