mirror of
https://github.com/rustdesk/rustdesk.git
synced 2025-12-12 11:06:57 +00:00
fix #4533
This commit is contained in:
@@ -1,7 +1,6 @@
|
||||
import 'dart:convert';
|
||||
import 'dart:ffi';
|
||||
import 'dart:io';
|
||||
import 'dart:typed_data';
|
||||
|
||||
import 'package:device_info_plus/device_info_plus.dart';
|
||||
import 'package:external_path/external_path.dart';
|
||||
@@ -9,10 +8,8 @@ import 'package:ffi/ffi.dart';
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:flutter_hbb/consts.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:package_info_plus/package_info_plus.dart';
|
||||
import 'package:path_provider/path_provider.dart';
|
||||
import 'package:win32/win32.dart' as win32;
|
||||
|
||||
import '../common.dart';
|
||||
import '../generated_bridge.dart';
|
||||
@@ -266,9 +263,9 @@ class PlatformFFI {
|
||||
|
||||
/// Start listening to the Rust core's events and frames.
|
||||
void _startListenEvent(RustdeskImpl rustdeskImpl) {
|
||||
() async {
|
||||
await for (final message
|
||||
in rustdeskImpl.startGlobalEventStream(appType: _appType)) {
|
||||
var sink = rustdeskImpl.startGlobalEventStream(appType: _appType);
|
||||
sink.listen((message) {
|
||||
() async {
|
||||
try {
|
||||
Map<String, dynamic> event = json.decode(message);
|
||||
// _tryHandle here may be more flexible than _eventCallback
|
||||
@@ -280,8 +277,8 @@ class PlatformFFI {
|
||||
} catch (e) {
|
||||
debugPrint('json.decode fail(): $e');
|
||||
}
|
||||
}
|
||||
}();
|
||||
}();
|
||||
});
|
||||
}
|
||||
|
||||
void setEventCallback(StreamEventHandler fun) async {
|
||||
|
||||
Reference in New Issue
Block a user