File tree 1 file changed +7
-6
lines changed
1 file changed +7
-6
lines changed Original file line number Diff line number Diff line change @@ -19,17 +19,18 @@ class BluetoothDevice {
19
19
20
20
/// Discovers services offered by the remote device as well as their characteristics and descriptors
21
21
Future <List <BluetoothService >> discoverServices () async {
22
- await FlutterBlue .instance._channel
23
- .invokeMethod ('discoverServices' , id.toString ());
24
-
25
- return await FlutterBlue .instance._servicesDiscoveredChannel
22
+ var response = FlutterBlue .instance._servicesDiscoveredChannel
26
23
.receiveBroadcastStream ()
27
- .map ((buffer) =>
28
- new protos.DiscoverServicesResult .fromBuffer (buffer))
24
+ .map ((buffer) => new protos.DiscoverServicesResult .fromBuffer (buffer))
29
25
.where ((p) => p.remoteId == id.toString ())
30
26
.map ((p) => p.services)
31
27
.map ((s) => s.map ((p) => new BluetoothService .fromProto (p)).toList ())
32
28
.first;
29
+
30
+ await FlutterBlue .instance._channel
31
+ .invokeMethod ('discoverServices' , id.toString ());
32
+
33
+ return response;
33
34
}
34
35
35
36
/// Returns a list of Bluetooth GATT services offered by the remote device
You can’t perform that action at this time.
0 commit comments