dotintent / FlutterBleLib

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

Change ScanResult#isConnectable from nullable boolean to non-nullable enum #588

Open mikolak opened 3 years ago

mikolak commented 3 years ago

https://github.com/Polidea/FlutterBleLib/pull/586#discussion_r610065825

Connectivity with 3 states: Connectivity.noInfo (or notAvailable?), Connectivity.notConnectable, Connectivity.Connectable

okocsis commented 3 years ago

Right now it's Bool? isConnectable so ternarily [null, false, true] it's nullable because it's only available on iOS host OS, on android it is still connectable so null very importantly does not mean false at all! Therefore I'd also recommend using a less misleading representation being the enum Connectivity [ .notAvailable| .unsupported, . notConnectable, .connectable] correspondingly mapping to the Bool? values above.