twilio_flutter 0.0.5

  • Readme
  • Changelog
  • Example
  • Installing
  • 84

Twilio_Flutter #

A Flutter package for both android and iOS which helps developers with Twilio API services.

Usage #

Example

To use this package :

  • add the dependency to your pubspec.yaml file.
dependencies:
  flutter:
    sdk: flutter
  twilio_flutter:

How to use #

Create a new Object

TwilioFlutter twilioFlutter; 

Initialize with values

twilioFlutter = TwilioFlutter(
    accountSid : '*************************', // replace *** with Account SID
    authToken : 'xxxxxxxxxxxxxxxxxx',  // replace xxx with Auth Token
    twilioNumber : '+...............'  // replace .... with Twilio Number
    );

Send SMS

twilioFlutter.sendSMS(
   toNumber : '+................', 
   messageBody : 'hello world'); 
   //Use sendSMS with the recipient number and message body.

View SMS List

var data;
data= await twilioFlutter.getSmsList(); //Returns list of SMS and SMS URL .

View Single SMS

await twilioFlutter.getSMS(messageSID); //Use message sid from the individual messages.

Change Twilio Number

twilioFlutter.changeTwilioNumber('+.........'); // To change the twilio number
Send WhatsApp Message (Experimental)
twilioFlutter.sendWhatsApp(toNumber : '+................', messageBody : 'hello world');

Features #

  • [x] Sms
  • [ ] Call
  • [ ] WhatsApp - Experimental feature

More features will get added soon. Contributions are also welcome.

Pull Requests #

Pull requests and contributions highly encouraged .Here are some basic rules to follow to ensure timely addition of your request:

  1. Match coding style (braces, spacing, etc.) This is best achieved using Reformat Code feature of Android Studio CMD+Option+L on Mac and CTRL + ALT + L on Linux + Windows .
  2. If its a feature, bug fix, or anything please only change code to what you specify.
  3. Please keep PR titles easy to read and descriptive of changes, this will make them easier to merge :)
  4. Pull requests must be made against develop branch. Any other branch (unless specified by the maintainers) will get rejected.
  5. Check for existing issues first, before filing an issue.
  6. Make sure you follow the set standard as all other projects in this repo do
  7. Have fun!

Getting Started #

For help getting started with Flutter, view our online documentation.

For help on editing package code, view the documentation.

[0.0.5] 2020-05-10 #

  • Updated Readme.

[0.0.4] 2020-05-02 #

  • Added Sms Listing .
  • Added Single Sms viewing.
  • Updated Readme.

[0.0.3] 2020-05-01 #

  • Updated README .

[0.0.2] 2020-04-29 #

  • Added experimental WhatsApp message functionality.

[0.0.1] - 2020-04-28 #

  • First release includes only SMS sending functionality.

example/lib/main.dart

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

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

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Flutter Demo',
      theme: ThemeData(
        primarySwatch: Colors.blue,
      ),
      home: MyHomePage(title: 'Twilio_Flutter'),
    );
  }
}

class MyHomePage extends StatefulWidget {
  MyHomePage({Key key, this.title}) : super(key: key);
  final String title;

  @override
  _MyHomePageState createState() => _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {
  TwilioFlutter twilioFlutter;

  @override
  void initState() {
    twilioFlutter = TwilioFlutter(
        accountSid: '**********************',
        authToken: 'xxxxxxxxxxxxxxxxxxxxxxxxx',
        twilioNumber: '+iiiiiiiiiiiiiiiiiiiiiiii');

    super.initState();
  }

  void sendSms() async {
    twilioFlutter.sendSMS(
        toNumber: '+917012250352', messageBody: 'hello world');
  }

  void getSms() async {
    var data = await twilioFlutter.getSmsList();
    print(data);

    await twilioFlutter.getSMS('***************************');
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text(widget.title),
      ),
      body: Center(
        child: Text(
          'Click the button to send SMS.',
        ),
      ),
      floatingActionButton: FloatingActionButton(
        onPressed: sendSms,
        tooltip: 'Send Sms',
        child: Icon(Icons.send),
      ),
    );
  }
}

Use this package as a library

1. Depend on it

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


dependencies:
  twilio_flutter: ^0.0.5

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:twilio_flutter/twilio_flutter.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
72
Health:
Code health derived from static analysis. [more]
99
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
90
Overall:
Weighted score of the above. [more]
84
Learn more about scoring.

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

  • Dart: 2.8.4
  • pana: 0.13.15
  • Flutter: 1.17.5

Analysis suggestions

Package not compatible with SDK dart

Because:

  • twilio_flutter that is a package requiring null.

Health issues and suggestions

Document public APIs. (-1 points)

37 out of 37 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.

Maintenance suggestions

Package is pre-v0.1 release. (-10 points)

While nothing is inherently wrong with versions of 0.0.*, it might mean that the author is still experimenting with the general direction of the API.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.1.0 <3.0.0
flutter 0.0.0
http ^0.12.1 0.12.1
meta ^1.1.8 1.1.8 1.2.2
Transitive dependencies
charcode 1.1.3
collection 1.14.12 1.14.13
http_parser 3.1.4
path 1.7.0
pedantic 1.9.0 1.9.2
sky_engine 0.0.99
source_span 1.7.0
string_scanner 1.0.5
term_glyph 1.1.0
typed_data 1.1.6 1.2.0
vector_math 2.0.8 2.1.0-nullsafety
Dev dependencies
flutter_test