一个Flutter插件,用于访问加速度计和陀螺仪传感器。
添加依赖
dependencies:
sensors: ^0.4.0+1
安装
flutter packages get
实例
import 'package:sensors/sensors.dart';
accelerometerEvents.listen((AccelerometerEvent event) {
// Do something with the event.
});
gyroscopeEvents.listen((GyroscopeEvent event) {
// Do something with the event.
});