flutter_reactive_ble_uart_example icon indicating copy to clipboard operation
flutter_reactive_ble_uart_example copied to clipboard

Bad state: Stream has already been listened to

Open HenriqueGuima opened this issue 2 years ago • 1 comments

It seems the code runs through this block a second time for some reason which gives me the Bad State Error. Is there a way to fix this?

_receivedDataStream =
                flutterReactiveBle.subscribeToCharacteristic(_txCharacteristic);
            _receivedDataStream.listen((data) {
              onNewReceivedData(data);
            }, onError: (dynamic error) {
              _logTexts = "${_logTexts}Error:$error$id\n";
            });

HenriqueGuima avatar Jul 15 '22 10:07 HenriqueGuima

Hi Henrique,

In my opinion it should be called only once.

Br Carl.

Op vr 15 jul. 2022 12:05 schreef Henrique Guimarães < @.***>:

It seems the code runs through this block a second time for some reason which gives me the Bad State Error. Is there a way to fix this?

_receivedDataStream = flutterReactiveBle.subscribeToCharacteristic(_txCharacteristic); _receivedDataStream.listen((data) { onNewReceivedData(data); }, onError: (dynamic error) { _logTexts = "${_logTexts}Error:$error$id\n"; });

— Reply to this email directly, view it on GitHub https://github.com/wolfc01/flutter_reactive_ble_uart_example/issues/5, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAJ5CCF4MRBSDRRUORORURLVUEZW5ANCNFSM53VCR7AA . You are receiving this because you are subscribed to this thread.Message ID: @.***>

wolfc01 avatar Oct 11 '22 09:10 wolfc01