flutter_compass 0.3.2

flutter_compass #

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.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

example/README.md

flutter_compass_example #

Demonstrates how to use the flutter_compass plugin.

Usage #


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

class _MyAppState extends State<MyApp> {
  double _direction;

  @override
  void initState() {
    super.initState();
    FlutterCompass.events.listen((double direction) {
      setState(() {
        _direction = direction;
      });
    });
  }

  @override
  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:


dependencies:
  flutter_compass: ^0.3.2

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';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
89
Health:
Code health derived from static analysis. [more]
100
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
90
Overall:
Weighted score of the above. [more]
92
Learn more about scoring.

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

  • Dart: 2.4.0
  • pana: 0.12.19
  • Flutter: 1.7.8+hotfix.3

Platforms

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.

Maintenance issues and suggestions

Support latest dependencies. (-10 points)

The version constraint in pubspec.yaml does not support the latest published versions for 1 dependency (rxdart).

Dependencies

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

Admin