mirror of
https://github.com/bytedream/Yamete-Kudasai.git
synced 2025-06-27 08:40:33 +02:00
Initial commit
This commit is contained in:
3
plugin/port_update/lib/port_update.dart
Normal file
3
plugin/port_update/lib/port_update.dart
Normal file
@ -0,0 +1,3 @@
|
||||
library port_update;
|
||||
|
||||
export 'src/port_update.dart' show PortUpdate, UpdateAction;
|
18
plugin/port_update/lib/src/port_update.dart
Normal file
18
plugin/port_update/lib/src/port_update.dart
Normal 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));
|
||||
}
|
Reference in New Issue
Block a user