simple_flutter_compass 0.1.1

  • README.md
  • CHANGELOG.md
  • Example
  • Installing
  • Versions
  • new59

simple_flutter_compass #

Simple Flutter Compass for accessing device's current heading (like a compass) using its magnetometer.

How to use :

  • Import the plugin
  • create an instance of SimpleFlutterCompass()
  • create a listener and set it to the new instance
  • call check() to see if device supports or has the hardware needed
  • call listen() to start listening for heading changes
  • call stopListen() when you're done

Import Plugin import 'package:simple_flutter_compass/simple_flutter_compass.dart';

Create Instance SimpleFlutterCompass _simpleFlutterCompass = SimpleFlutterCompass();

Create and set litsener void _streamListener(double currentHeading) { //do something with the currentHeading }

_simpleFlutterCompass.setListener(_streamListener);

Check if hardware is present __simpleFlutterCompass.check();

Start listening _simpleFlutterCompass.listen();

Stop listening _simpleFlutterCompass.stopListen();

Please check the example app for reference on actual plugin usage.

0.1.1 #

udpated the readme and example codes

0.1.0 #

Added more description and example code. Corrected plugin version

0.0.1 #

initial release

example/README.md

simple_flutter_compass_example #

Demonstrates how to use the simple_flutter_compass plugin.

Getting Started #

Import Plugin

import 'package:simple_flutter_compass/simple_flutter_compass.dart';

Create Instance

SimpleFlutterCompass _simpleFlutterCompass = SimpleFlutterCompass();

Check if hardware exists and set a listener

_simpleFlutterCompass.check().then((result) {
    if (result) {
        _simpleFlutterCompass.setListener(_streamListener);
    } else {
        print("Hardware not available");
    }
});

void _streamListener(double currentHeading) {
    setState(() {
      //we set the new heading value to our _compas variable to display on screen
      _compas = currentHeading;
    });
}

Start listening

_simpleFlutterCompass.listen();

Stop listening

_simpleFlutterCompass.stopListen();

Use this package as a library

1. Depend on it

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


dependencies:
  simple_flutter_compass: ^0.1.1

2. Install it

You can install packages from the command line:

with Flutter:


$ flutter packages get

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

3. Import it

Now in your Dart code, you can use:


import 'package:simple_flutter_compass/simple_flutter_compass.dart';
  
Version Uploaded Documentation Archive
0.1.1 Mar 20, 2019 Go to the documentation of simple_flutter_compass 0.1.1 Download simple_flutter_compass 0.1.1 archive
0.1.0 Mar 11, 2019 Go to the documentation of simple_flutter_compass 0.1.0 Download simple_flutter_compass 0.1.0 archive
0.0.1 Mar 11, 2019 Go to the documentation of simple_flutter_compass 0.0.1 Download simple_flutter_compass 0.0.1 archive
Popularity:
Describes how popular the package is relative to other packages. [more]
17
Health:
Code health derived from static analysis. [more]
100
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
100
Overall:
Weighted score of the above. [more]
59
Learn more about scoring.

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

  • Dart: 2.2.0
  • pana: 0.12.14
  • Flutter: 1.3.3

Platforms

Detected platforms: Flutter

References Flutter, and has no conflicting libraries.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.1.0 <3.0.0
flutter 0.0.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
Dev dependencies
flutter_test