disconnectDevice static method
Implementation
static Future<bool> disconnectDevice() async {
/// Stream method
final stream = FlutterNewposSdk._methodStream.stream
.where((m) => m.method == 'OnDeviceDisConnected')
.map((m) {
return m.arguments as bool;
});
try {
await _invokeMethod('disconnectDevice');
final streamOutputs = await getFirstResultInStream(
stream,
const Duration(seconds: 5),
);
final result = streamOutputs ?? false;
return result;
} on TimeoutException {
return false;
} catch (e) {
throw BluetoothConnectionFailed(code: '');
}
}