refactor(lib): create structure with base and interface

This commit is contained in:
ksenia312
2024-02-04 19:28:28 +01:00
parent 90c2908496
commit 3f7495a6a4
31 changed files with 423 additions and 383 deletions
+3 -3
View File
@@ -35,14 +35,14 @@ class MethodChannelNearbyService extends NearbyServicePlatform {
}
@override
Future<List<NearbyDevice>> getPeers() async {
Future<List<NearbyDeviceBase>> getPeers() async {
return NearbyDeviceMapper.instance.mapToDeviceList(
await methodChannel.invokeMethod('fetchPeers'),
);
}
@override
Stream<List<NearbyDevice>> getPeersStream() {
Stream<List<NearbyDeviceBase>> getPeersStream() {
const peersChannel = EventChannel("nearby_service_peers");
return peersChannel.receiveBroadcastStream().map((e) {
return NearbyDeviceMapper.instance.mapToDeviceList(e);
@@ -50,7 +50,7 @@ class MethodChannelNearbyService extends NearbyServicePlatform {
}
@override
Stream<NearbyDevice?> getConnectedDeviceStream(NearbyDevice device) {
Stream<NearbyDeviceBase?> getConnectedDeviceStream(NearbyDeviceBase device) {
const connectedDeviceChannel = EventChannel(
"nearby_service_connected_device",
);