dotintent / FlutterBleLib

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

Fetching state of the native client #559

Closed zobo closed 3 years ago

zobo commented 3 years ago

As it seems, BleManager.createClient should only ever be called once (unless destoryClient is also called) but there is no way to know, if it was already called. BleManager however is a singleton.

Currently I try to solve this with a Wrapper class, that will track this.

Perhaps add a bool get isCreated ?

Are there any other patterns how this is usually solved?

Thank you.

mikolak commented 3 years ago

I'm currently using it with Riverpod, which keeps state alive between reloads, with a bool flag in the state that tracks whether it was initiated or not.

I was thinking about adding such a flag for some time now. I'll use this issue to track it.