messenger_launcher

A new flutter plugin project for launching messenger.

Installation

First, add messenger_launcher as a dependency in your pubspec.yaml file.

iOS

Add the following entry to your Info.plist file, located in /ios/Runner/Info.plist:

<key>LSApplicationQueriesSchemes</key>
<array>
  <string>fb-messenger</string>
</array>

Example

import 'package:flutter/material.dart';
import 'package:messenger_launcher/messenger_launcher.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 openMessenger() async {
    await MessengerLauncher.launchMessenger("messengerId");
  }

  @override
  Widget build(BuildContext context) {
    return new MaterialApp(
      home: new Scaffold(
        appBar: new AppBar(
          title: new Text('Plugin example app'),
        ),
        body: new Center(
          child: FlatButton(
            child: Text("Open Messenger"),
            onPressed: () {
              openMessenger();
            },
          )
        ),
      ),
    );
  }
}

Libraries

messenger_launcher