freezer/lib/api/download_manager/service_interface.dart
Pato05 7a119d281c
fix email login, fix spotify importer
migrate to dio instead of http, with unique cookiejar
2023-10-21 01:12:33 +02:00

22 lines
576 B
Dart

import 'dart:isolate';
import 'package:flutter_background_service/flutter_background_service.dart';
class ServiceInterface {
final ReceivePort? receivePort;
final ServiceInstance? service;
ServiceInterface({this.receivePort, this.service})
: assert(receivePort != null || service != null);
Stream<Map<String, dynamic>?> on(String method) {
if (service != null) {
return service!.on(method);
}
return receivePort!
.where((event) => event['method'] == method)
.map((event) => (event as Map?)?.cast<String, dynamic>());
}
}