iot_notification 0.4.2
iot_notification: ^0.4.2 copied to clipboard
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";
}