This commit is contained in:
Fabian Freund committed 2025-02-16 23:21:44 +01:00
1 parent ddb0f14059
commit 6368e30479
81 files changed
+20308 -88

No files matched your search

@@ -0,0 +1,22 @@
import 'package:flutter_background_service/flutter_background_service.dart';
import 'package:tor/tor.dart';
@pragma('vm:entry-point')
void onStart(ServiceInstance service) async {
await Tor.init();
final portSub = Tor.instance.events.stream.listen((port) {
service.invoke('portUpdate', {'port': port});
});
await Tor.instance.start();
service.on("stop").listen((event) async {
Tor.instance.stop();
service.invoke('portUpdate', {'port': -1});
await portSub.cancel();
await service.stopSelf();
});
}