iot_notification 0.4.2 copy "iot_notification: ^0.4.2" to clipboard
iot_notification: ^0.4.2 copied to clipboard

outdated

A new Flutter plugin.

example/lib/main.dart

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

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

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

class _MyAppState extends State<MyApp> {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(
          title: const Text('Iot Notification Example'),
        ),
        body: Center(
            child: Column(children: <Widget>[
          ElevatedButton(
              child: Text("Start Service"),
              onPressed: () {
                IotNotification.startService(
                    "user-access-token",
                    "user-refresh-token",
                    "app-access-token",
                    "app-refresh-token",
                    "mqtt-identifier",
                    "iot.samelement.com",
                    "ssl",
                    8883,
                    "server-host",
                    entrustRootCertificateAuthority);
              }),
          ElevatedButton(
              child: Text("Scan Barcode"),
              onPressed: () async {
                String result = await IotNotification.scan();
                print("QR CODE $result");
              }),
          ElevatedButton(
              child: Text("Get Keys"),
              onPressed: () async {
                List<String> keys = await IotNotification.getKeys();
                print(keys[0]);
                print(keys[1]);
              }),
          ElevatedButton(
              child: Text("Stop service"),
              onPressed: () async {
                IotNotification.stopService();
              })
        ])),
      ),
    );
  }

  String entrustRootCertificateAuthority = "-----BEGIN CERTIFICATE-----\n" +
      "abcdefgh123456789\n" +
      "-----END CERTIFICATE-----\n";
}
0
likes
0
points
35
downloads

Publisher

unverified uploader

Weekly Downloads

A new Flutter plugin.

Homepage

License

unknown (license)

Dependencies

flutter

More

Packages that depend on iot_notification

Packages that implement iot_notification