Skip to content
pubscout

sensors_plus

7.1.1, released 7 weeks ago by fluttercommunity.dev

Flutter plugin to access accelerometer, gyroscope, magnetometer, and barometer sensors.

Flutter FavoriteWASM-readyRock solid
$ flutter pub add sensors_plus
Source repository

What it does

Provides a set of broadcast streams to access device sensors such as accelerometer, user accelerometer, gyroscope, magnetometer, and barometer. Allows configuring sampling rates where supported by the platform.

AI-written summary of version 7.1.1, based on the package's README and metadata. Report an inaccuracy

Use it when

  • You need to read motion, rotation, or orientation data from physical device sensors.
  • You are building a compass, pedometer, or motion-controlled game/utility.

Skip it when

  • You need sensor access on unsupported platforms like Windows, Linux, or macOS.
  • You require magnetometer or barometer features on web browsers where they are not supported.

Strengths

  • Supports multiple crucial sensors like accelerometer, gyroscope, magnetometer, and barometer.
  • Provides stream-based event handling with customizable sampling intervals.
  • Recognized as a Flutter Favorite package.

Weaknesses

  • Platform restrictions apply (e.g., no macOS, Windows, or Linux support; limited web and iOS capabilities).
  • Some low-end or older Android devices might lack specific sensors, requiring manual error handling.

Setup

Kind
Plugin (native code)
Effort
Low
Code generation
No
Direct dependencies
1

On iOS, you must include the NSMotionUsageDescription key in Info.plist to prevent crashes when accessing barometer data.

import 'package:sensors_plus/sensors_plus.dart';

accelerometerEvents.listen(
  (AccelerometerEvent event) {
    print(event);
  },
  onError: (error) {
    // Logic to handle error
    },
  cancelOnError: true,
);

Alternatives

Packages that do the same job and could replace sensors_plus.

Works with

Packages commonly used together with sensors_plus: ones it builds on, ones built on it, and its own family.