'Flutter disconnect and dispose bluetooth devices in proper method

Im using flutter reactive plugin https://pub.dev/packages/flutter_reactive_ble

For connect and fetching data from multiple devices.

Successfully i have connected to multiple bluetooth devices(4 devices) to receive data

My question is how to disconnect multiple devices at a time.

In the reactive ble document i found that, disconnect only works for last connected device. Can someone eloborate about how to disconnect multiple devices at a time



Solution 1:[1]

As you connect to devices save a list of the DiscoveredDevice. When you want to disconnect, just loop through the list and disconnect each.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 l984_451