FlutterBleLib icon indicating copy to clipboard operation
FlutterBleLib copied to clipboard

Unhandled Exception: BleError (Error code: 2, ATT error code: null, iOS error code: null)

Open sivaperumal644 opened this issue 4 years ago • 5 comments

While trying to connect device it throws the below error sometimes and not always. I couldn't identify what causes this.

[ERROR:flutter/lib/ui/ui_dart_state.cc(199)] Unhandled Exception: BleError (Error code: 2, ATT error code: null, iOS error code: null, Android error code: null, reason: null, internal message: null, device ID: null, service UUID: null, characteristic UUID: null, descriptor UUID: null)

The error code does not remain the same it changes to 2, 205, 204 and many but couldn't handle this error.

I tried connect(requestMtu: 250).catchError((){print("some error")}) and connect(requestMtu: 250).onError((error, stacktrace) {print("error");});. But it didn't go into catch or the error block.

Couldn't identify what is causing this exception to occur at the first place, and also don't how to handle this exception.

sivaperumal644 avatar Sep 02 '21 08:09 sivaperumal644

Get the same error - I think it is known by the package owner but he is not fixing it. I am wondering if someone branched the package and fixed all the issues because otherwise, this package is solid.

ride4sun avatar Dec 21 '21 23:12 ride4sun

Hi @sivaperumal644 @ride4sun

Did you all manage to get workaround for this issue. I am too still getting this error.

skashok avatar Jun 03 '22 05:06 skashok

same here...please find a workaround fix :(

freedreamer82 avatar Jun 03 '22 14:06 freedreamer82

there was some discussion of alternatives in #613. I also think i found a list of what the codes mean: https://github.com/dotintent/FlutterBleLib/blob/a4df42eda471f0c53a06b7b9937db8b59585f318/lib/error/ble_error.dart#L55

TL;DR: 2 -> operationCancelled 204 -> deviceNotFound 205 -> deviceNotConnected

that might help solve your more immediate issue, and judging by this it seems like this particular issue may just be a case of "the error is not great at explaining what went wrong to humans" rather than "something is broken in the library that isnt fixed yet"

MoralCode avatar Jun 10 '22 00:06 MoralCode

Hi @sivaperumal644 @ride4sun

Did you all manage to get workaround for this issue. I am too still getting this error.

@skashok I couldn't find a solution and I had few more deprecated issues in both android and iOS with this plugin, So I decided to use a different plugin. I used flutter_blue_plugin.

sivaperumal644 avatar Jun 11 '22 18:06 sivaperumal644