flutter_compass 0.3.3

  • Readme
  • Changelog
  • Example
  • Installing
  • 95

flutter_compass #

pub package

A Flutter compass. The heading varies from 0-360, 0 being north.

For IOS: #

Make sure to add NSLocationWhenInUseUsageDescription and NSLocationAlwaysAndWhenInUseUsageDescription keys with appropriate descriptions to the Info.plist file.

0.3.3 #

  • Update permission_handler to 3.2.2
  • Update rxdart to 3.2.2

0.3.2 #

  • Android: The plugin will now remember the last read azimuth. This will be done across Isolates using a static variable. Additionally, the value is cached within the isolate with the introduction of a RxDart BehaviorSubject. Reading the current azimuth using await FlutterCompass.events.first will therefore not hang anymore when th user has not moved the handset at all.
  • Sample updated to cover the functional updates in Android.
  • Added missing locatio permissions to the Android example which prevented the permission dialog from being shown.

0.3.1 #

  • iOS: Remove permission request when Plugin is instantiated. Library users are responsible to request location permission by themselves.
  • Request permission in the example directly.

0.3.0 #

  • Replace kotlin code with simple java to reduce integration complexity

0.2.0 #

  • Upgrade Android build components (Kotlin version) Breaking change. Migrate from the deprecated original Android Support Library to AndroidX. This shouldn't result in any functional changes, but it requires any Android apps using this plugin to also migrate if they're using the original support library.
  • Upgrade iOS component to Swift 4.2

0.1.0 #

  • Added example
  • Added public api docs

0.0.3 #

  • bug fixes

0.0.2 #

  • Android emulator fix

0.0.1 #

  • flutter compass plugin


flutter_compass_example #

Demonstrates how to use the flutter_compass plugin.

Usage #

class MyApp extends StatefulWidget {
  _MyAppState createState() => new _MyAppState();

class _MyAppState extends State<MyApp> {
  double _direction;

  void initState() {
    FlutterCompass.events.listen((double direction) {
      setState(() {
        _direction = direction;

  Widget build(BuildContext context) {
    return new MaterialApp(
      home: new Scaffold(
        appBar: new AppBar(
          title: const Text('Flutter Compass'),
        body: new Container(
          alignment: Alignment.center,
          color: Colors.white,
          child: new Transform.rotate(
            angle: ((_direction ?? 0) * (math.pi / 180) * -1),
            child: new Image.asset('assets/compass.jpg'),

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:

  flutter_compass: ^0.3.3

2. Install it

You can install packages from the command line:

with Flutter:

$ flutter pub get

Alternatively, your editor might support flutter pub get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:

import 'package:flutter_compass/flutter_compass.dart';
Describes how popular the package is relative to other packages. [more]
Code health derived from static analysis. [more]
Reflects how tidy and up-to-date the package is. [more]
Weighted score of the above. [more]
Learn more about scoring.

We analyzed this package on Oct 20, 2019, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.5.1
  • pana: 0.12.21
  • Flutter: 1.9.1+hotfix.4


Detected platforms: Flutter

References Flutter, and has no conflicting libraries.

Health suggestions

Fix lib/flutter_compass.dart. (-0.50 points)

Analysis of lib/flutter_compass.dart reported 1 hint:

line 21 col 27: Close instances of dart.core.Sink.


Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.0.0-dev.68.0 <3.0.0
flutter 0.0.0
rxdart ^0.22.3 0.22.4
Transitive dependencies
collection 1.14.11 1.14.12
meta 1.1.7
sky_engine 0.0.99
typed_data 1.1.6
vector_math 2.0.8