dotintent / FlutterBleLib

Bluetooth Low Energy library for Flutter with support for simulating peripherals
Apache License 2.0
535 stars 197 forks source link

observeConnectionState throws a TypeError since 2.2.7 #499

Closed devais-eng closed 4 years ago

devais-eng commented 4 years ago

The method observeConnectionState always throws a TypeError since release 2.2.7 , making it unusable.

type '_BroadcastStream<dynamic>' is not a subtype of type 'Stream<String>'

The problem seems to be caused by this line: https://github.com/Polidea/FlutterBleLib/blob/6f05b2fb3cfbeaee260f57d6106fc9ca0f878dca/lib/src/bridge/device_connection_mixin.dart#L41

A working solution might be mapping over the source BroadcastStream:

.map((dynamic state) => state.toString())

I hope this was helpful.

Thank you for your awesome work.

devais-eng commented 4 years ago

I only see now that you have already opened a PR for this bug.

I'll reference it here: #498