plus_plugins
plus_plugins copied to clipboard
[Request]: Expose device orientation events
Plugin
sensors_plus
Use case
Device orientation (in world coordinates) is often desired and seems to be implemented for android/ios/web under TYPE_ORIENTATION_VECTOR, CMQuaternion and onDeviceOrientation respectively.
My understanding is these use non-trivial sensor fusion algorithms that are more sophisticated than simply integrating gyroscope measurements.
Related to #764
Proposal
Expose a Stream<DeviceOrientationEvent> orientationEvents.
If it will be considered for acceptance, I could hack up a PR based on other stream implementations, though my experience with android/ios is non-existent.
I would like to see this implemented as well. I needed access to TYPE_ORIENTATION_VECTOR and was a bit surprised as to why that sensor is not included in the plugin.
@jackd I would assume that setting up a near identical stream would be sufficient? The only thing you'd have to worry about is mapping the native types to a Dart type but that is just conversion?
If one just wants to change the UI, then OrientationBuilder can be handy, but in cases where you don't want to change the UI and just know device orientation, it falls flat. This change should not be very difficult to implement, I'll try my hand at it.