mirror of
https://github.com/bytedream/Yamete-Kudasai.git
synced 2025-06-28 09:10:32 +02:00
Initial commit
This commit is contained in:
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