motion_core 0.1.0
motion_core: ^0.1.0 copied to clipboard
A high-performance Flutter plugin that provides a simple, unified stream of fused device motion data, abstracting native APIs like iOS Core Motion and Android's Rotation Vector sensor.
0.1.0 #
Bug-fix and feature-parity release. The native payload changed, so upgrade the plugin as a whole (a hot restart is enough during development).
Fixed #
- Android emitted nothing on many devices. Samples were held back until the
rotation vector reported
SENSOR_STATUS_ACCURACY_HIGH, which many phones never do. Samples are now delivered as soon as the fused sensors have data. - Units and signs differed between platforms. iOS sent G with gravity
pointing down, Android sent m/s² with gravity pointing up. Both now report
m/s² with the Android /
sensors_plussign convention (flat, face-up device ≈(0, 0, +9.81);userAccelerationpositive in the direction of motion). - Yaw was not comparable between platforms. iOS used the arbitrary reference frame while Android used the north-referenced rotation vector, and Core Motion's north frame puts +X on north where Android puts +Y. Both platforms now use a north-referenced East-North-Up frame by default.
pitchandrollwere swapped relative to the phone conventions used by both platform APIs.pitchis now the rotation about the device X axis (top edge up/down) androllthe rotation about the Y axis.eulerAnglesis unchanged:(x, y, z)are still the angles about the device X, Y, Z axes.- Sensors were never released when the Flutter engine was destroyed while a
subscription was active (both platforms). The iOS plugin was not published
to the registrar, so
detachFromEnginecould never run. - Android read the heading accuracy from a fixed-size buffer instead of the
event, so devices reporting fewer than five rotation-vector values produced
0.0instead of "unavailable"; the quaternion could also be wrong when the scalar part was not reported. - An unsupported platform (web, desktop) made
isAvailable()throwMissingPluginException; it now returnsfalse. - The Android unit test targeted a method that does not exist; replaced with real tests for the method channel and payload encoding.
- Removed the deprecated
packageattribute from the Android manifest, fixed the Podspec metadata and bundled the iOS privacy manifest.
Added #
MotionCore.configure(updateInterval:, referenceFrame:, showsCalibrationDisplay:)to pick the sample rate (both platforms) and the attitude reference frame:arbitraryZVertical,arbitraryCorrectedZVertical,magneticNorthZVertical(default) ortrueNorthZVertical. Maps toCMAttitudeReferenceFrameon iOS and toTYPE_GAME_ROTATION_VECTOR/TYPE_ROTATION_VECTOR(withTYPE_GEOMAGNETIC_ROTATION_VECTORas a fallback) on Android.MotionCore.availableReferenceFrames().MotionData.rotationRate(bias-corrected gyroscope, rad/s).MotionData.magneticField(calibrated magnetometer in µT withMagneticFieldCalibrationAccuracy).MotionData.heading(degrees clockwise from north, computed identically on both platforms;nullfor arbitrary frames).MotionData.referenceFrame(the frame actually in use) andMotionData.timestamp(seconds since boot).- Swift Package Manager support (
ios/motion_core/Package.swift); CocoaPods keeps working. - Dart unit tests.
Changed (breaking) #
MotionData.headingAccuracyis nowdouble?(as the README always said) and isnullinstead of-1.0when unavailable.- Euler getters moved from the
MotionDataEulerextension intoMotionData. - Samples are sent as a
Float64Listof 20 values;MotionData.fromListstill accepts the old 11-value layout.
0.0.5 #
- Added new example.dart
0.0.4 #
- Update readme
0.0.3 #
- Update Github link
0.0.2 #
- Update Readme.
0.0.1 #
- Initial release.