Closed opsb closed 3 years ago
Hi @opsb
I merged your PR, but on a separate branch (1.1.2-prenullsafety), since the package you use there is quite old and not updated to nullsafety, I would not include the code in final 1.3.0 version which will have the concept of nullsafety first.
I fixed some issues releated to overwriting the subs by tracking queries, you may check how it works on master branch
Describe the bug When you call
HealthKitReporter.anchoredObjectQuery
and then later call it again to create a new anchoredObjectQuery the original one is cancelled.To Reproduce Steps to reproduce the behavior:
Expected behavior You should be able to create any number of anchoredObjectQuerys that run as independent streams.
Additional context A single
AnchoredObjectQueryStreamHandler
is registered with the event channel at https://github.com/VictorKachalov/health_kit_reporter/blob/master/ios/Classes/SwiftHealthKitReporterPlugin.swift#L69.AnchoredObjectQueryStreamHandler
only has a singlequery
though which is replaced at https://github.com/VictorKachalov/health_kit_reporter/blob/master/ios/Classes/AnchoredObjectQueryStreamHandler.swift#L36 wheneverHealthKitReporter.anchoredObjectQuery
is called.I'm new to Flutter/Dart so I'm not sure how this tends to be handled but in other languages using channels I've used an identifier (say a uuid) for the stream that is created for a particular call to
HealthKitReporter.anchoredObjectQuery
. That way it's possible to have multiple AnchoredQueries on the Swift side and use the uuid to route messages appropriately on the Dart side.