A Flutter plugin for accessing the accelerometer, gyroscope, magnetometer, and orientation sensors on Android and iOS devices.
This package was originally developed by Zesage but has not been updated for over years. To maintain its functionality and improve performance, I have refined the package and released a new version.
Android | iOS | MacOS | Web | Linux | Windows |
---|---|---|---|---|---|
✅ | ✅ | ❌ | ❌ | ❌ | ❌ |
- Flutter: >=3.19.0
- Dart: >=3.3.0 <4.0.0
- iOS: >=12.0
- Android: compileSDK 34, Java 17, Android Gradle Plugin >=8.1.0, Gradle wrapper >=8.3
Add motion_sensor
as a dependency in your pubspec.yaml
file.
dependencies:
motion_sensor: ^0.0.1
import 'package:motion_sensor/motion_sensor.dart';
motionSensor.magnetometer.listen((MagnetometerEvent event) {
print(event);
});