Initial commit

This commit is contained in:
2021-11-16 22:29:44 +01:00
commit bd221bb030
49 changed files with 1248 additions and 0 deletions

View File

@ -0,0 +1,3 @@
library port_update;
export 'src/port_update.dart' show PortUpdate, UpdateAction;

View File

@ -0,0 +1,18 @@
import 'package:flutter/services.dart';
enum UpdateAction {
unknown,
batteryCharging,
batteryDischarging,
batteryFull,
headphoneConnected,
headphoneDisconnected
}
class PortUpdate {
static const channel = "port/stream";
final _channel = const EventChannel(channel);
Stream<UpdateAction?> get stream => _channel.receiveBroadcastStream().map((event) => UpdateAction.values.elementAt(event));
}