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

PlatformAndroid

A Flutter SMS plugin which requests permissions to send SMS in background without UI interactions.

example/lib/main.dart

import 'dart:async';

import 'package:easy_send_sms/easy_sms.dart';
import 'package:flutter/foundation.dart';
import 'package:flutter/material.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> {
  final _easySmsPlugin = EasySms();

  Future<void> sendSms({required String phone, required msg}) async {
    try {
      await _easySmsPlugin.requestSmsPermission();
      await _easySmsPlugin.sendSms(phone: phone, msg: msg);
    } catch (err) {
      if (kDebugMode) {
        print(err.toString());
      }
    }
  }

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

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(
          title: const Text('Send SMS example app'),
        ),
        body: Center(
          child: ElevatedButton(
            onPressed: () {
              // enter mobile number here
              sendSms(phone: '+xxxxxxxxx', msg: 'This is a test !!');
            },
            child: const Text('send sms'),
          ),
        ),
      ),
    );
  }
}
0
likes
140
points
14
downloads

Publisher

unverified uploader

Weekly Downloads

A Flutter SMS plugin which requests permissions to send SMS in background without UI interactions.

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (license)

Dependencies

flutter, permission_handler, plugin_platform_interface

More

Packages that depend on easy_send_sms

Packages that implement easy_send_sms