mirror of
https://github.com/lollipopkit/flutter_server_box.git
synced 2025-12-17 15:24:35 +01:00
feat: stop all servers in noti center (#901)
This commit is contained in:
@@ -77,8 +77,10 @@ abstract final class MethodChans {
|
||||
}
|
||||
|
||||
/// Register a handler for native -> Flutter callbacks.
|
||||
/// Currently handles: `disconnectSession` with argument map {id: string}
|
||||
static void registerHandler(Future<void> Function(String id) onDisconnect) {
|
||||
/// Currently handles:
|
||||
/// - `disconnectSession` with argument map {id: string}
|
||||
/// - `stopAllConnections` with no arguments
|
||||
static void registerHandler(Future<void> Function(String id) onDisconnect, [VoidCallback? onStopAll]) {
|
||||
_channel.setMethodCallHandler((call) async {
|
||||
switch (call.method) {
|
||||
case 'disconnectSession':
|
||||
@@ -88,6 +90,9 @@ abstract final class MethodChans {
|
||||
await onDisconnect(id);
|
||||
}
|
||||
return;
|
||||
case 'stopAllConnections':
|
||||
onStopAll?.call();
|
||||
return;
|
||||
default:
|
||||
return;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user