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

outdated

A flutter plugin for receiving incoming sms in android. Currently supports on only Android.

example/lib/main.dart

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

void main() => runApp(MyApp());

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

class _MyAppState extends State<MyApp> {
  String _smsBody = 'Unknown';

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

  retrieveNewSms() async {
    _smsBody = await SmsDetector.waitForSmsReceive();
    setState(() {});
  }


  @override
  void dispose() {
    //stop sms receiver
    SmsDetector.stopSmsReceiver();
    super.dispose();
  }

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(
          title: const Text('Plugin example app'),
        ),
        body: Center(
          child: Column(
            mainAxisSize: MainAxisSize.min,
            children: <Widget>[
              Center(
                child: Text('SMS Body : $_smsBody'),
              ),
            ],
          ),
        ),
      ),
    );
  }
}
0
likes
40
pub points
0%
popularity

Publisher

unverified uploader

A flutter plugin for receiving incoming sms in android. Currently supports on only Android.

Repository (GitHub)
View/report issues

License

BSD-3-Clause (LICENSE)

Dependencies

flutter

More

Packages that depend on sms_detector