sms_helper 0.0.1 copy "sms_helper: ^0.0.1" to clipboard
sms_helper: ^0.0.1 copied to clipboard

PlatformAndroid

A flutter plugin to help you get the device's sms. Only Android.

example/lib/main.dart

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

import 'package:permission_handler/permission_handler.dart';
import 'package:sms_helper/sms_helper.dart';

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

class MyApp extends StatefulWidget {
  const MyApp({Key? key}) : super(key: key);

  @override
  State<MyApp> createState() => _MyAppState();
}

class _MyAppState extends State<MyApp> {

  @override
  void initState() {
    super.initState();
    _requestPermissions();
  }

  Future<void> _requestPermissions() async {
    Map<Permission, PermissionStatus> statuses = await [
      Permission.sms,
      Permission.contacts,
      Permission.storage
    ].request();
    if (statuses[Permission.sms] == PermissionStatus.granted &&
        statuses[Permission.contacts] == PermissionStatus.granted &&
        statuses[Permission.storage] == PermissionStatus.granted) {
      _getSms();
    }
  }

  _getSms() {
    SmsHelper.getSmsList().then((value) {
      print(value);
    });
  }

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(
          title: const Text('Plugin example app'),
        ),
        body: Container(
        ),
      ),
    );
  }
}
1
likes
140
points
1
downloads

Publisher

unverified uploader

Weekly Downloads

A flutter plugin to help you get the device's sms. Only Android.

Homepage

Documentation

API reference

License

unknown (license)

Dependencies

flutter

More

Packages that depend on sms_helper

Packages that implement sms_helper