position_sensors 0.0.3 copy "position_sensors: ^0.0.3" to clipboard
position_sensors: ^0.0.3 copied to clipboard

PlatformAndroid

A plugin to access information about position sensors.

position_sensors #

pub.dev link

A plugin to access information about position sensors.

Usage #

The PositionSensors class contains all methods and events listeners.

import 'package:position_sensors/position_sensors.dart';

// Listen to rotation events
PositionSensors.rotationEvents.listen((event) {
    print("Rotation vector: [x: ${event.x}, y: ${event.x}, z: ${event.z}]")
    // Rotation vector: [x: 0.0, y: 0.0, z: 0.0]
});

print(await PositionSensors.supportedSensors);
// [proximity, rotation]

final int SENSOR_DELAY_GAME = 1;
await PositionSensors.setDelay(1);
print(await PositionSensors.delay);
// 1

// the maximum value, especially useful for binary proximity sensors
print(await PositionSensors.proximityFarValue);

The following sensors are available:

Combination of sensors Listener Output
accelerometer + gyroscope + magnetometer rotationEvents RotationEvent
accelerometer + gyroscope gameRotationEvents RotationEvent
accelerometer + magnetometer magneticRotationEvents RotationEvent
magnetometer magneticFieldEvents MagneticFieldEvent
magnetometer uncalibratedMagneticFieldEvents MagneticFieldEvent
proximity proximityEvents ProximityEvent

See more in https://developer.android.com/guide/topics/sensors/sensors_position.

2
likes
130
pub points
8%
popularity

Publisher

unverified uploader

A plugin to access information about position sensors.

Repository (GitHub)
View/report issues

Documentation

API reference

License

BSD-3-Clause, MIT (LICENSE)

Dependencies

flutter, position_sensors_platform_interface

More

Packages that depend on position_sensors