flutter_launch 0.1.0 copy "flutter_launch: ^0.1.0" to clipboard
flutter_launch: ^0.1.0 copied to clipboard

outdatedDart 1 only

A Flutter plugin for iOS and Android to open whatsApp from a button.

example/lib/main.dart

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


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

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

class _MyAppState extends State<MyApp> {

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

  void whatsAppOpen() async {
    bool whatsapp = await FlutterLaunch.hasApp(name: "whatsapp");

    if (whatsapp) {
      await FlutterLaunch.launchWathsApp(phone: "5534992016545", message: "Hello");
    } else {
      print("Whatsapp não instalado");
    }
  }

  @override
  Widget build(BuildContext context) {
    return new MaterialApp(
      home: new Scaffold(
        appBar: new AppBar(
          title: new Text('Plugin example app'),
        ),
        body: Center(
          child: FlatButton(
            child: Row(
              mainAxisAlignment: MainAxisAlignment.center,
              children: <Widget>[
                Text("Whatsapp",)
              ],
            ),
            onPressed: () {
              whatsAppOpen();
            },
          )
        ),
      ),
    );
  }
}
34
likes
0
pub points
91%
popularity

Publisher

unverified uploader

A Flutter plugin for iOS and Android to open whatsApp from a button.

Repository (GitHub)
View/report issues

License

unknown (LICENSE)

Dependencies

flutter

More

Packages that depend on flutter_launch