Skip to content

Latest commit

 

History

History
42 lines (35 loc) · 1008 Bytes

useUserAccelerometer.md

File metadata and controls

42 lines (35 loc) · 1008 Bytes

useUserAccelerometer

Tracks the state of device accelerometer with gravity removed.

Installation

Depends on sensors_plus.

dependencies:
  flutter_use_sensors: ^0.0.2

Usage

class Sample extends HookWidget {
  @override
  Widget build(BuildContext context) {
    final userAccelerometerState = useUserAccelerometer();
    return Scaffold(
      body: Center(
        child: Column(
          mainAxisAlignment: MainAxisAlignment.center,
          crossAxisAlignment: CrossAxisAlignment.center,
          children: [
            Text(
                "userAccelerometerState: ${userAccelerometerState.userAccelerometer}"),
          ],
        ),
      ),
    );
  }
}

Reference

  • fetched: bool - whether device accelerometer with gravity removed state is fetched;
  • userAccelerometer: UserAccelerometerEvent - device accelerometer with gravity removed state changes.
    • x
    • y
    • z