Pakete, Repositories und App-Kategorien suchen

GitHub-RepositoryLJaraCastillo/flutter_sensor_compass

flutter_sensor_compass

Ein Plugin zur Ermittlung der Ausrichtung des Geräts (in Grad) relativ zum magnetischen Nordpol.

Projektcover von flutter_sensor_compass
Sterne
1
Forks
1
Letzter Push (UTC)
26.11.2019
Projektstatus
Aktiv

Original-README

Englischer Projektschnappschuss. Aktuelle Inhalte auf GitHub.

flutter_sensor_compass

A plugin to get the orientation of the device (in degrees) relative to the magnetic north.

Installation

First add the plugin in your project. Copy the following line below dependencies in your pubspec.yaml file.

dependencies:
     ...
    flutter_sensor_compass: ^0.1.1

Then you need to import the dependency.

import 'package:flutter_sensor_compass/flutter_sensor_compass.dart';
iOS only

You need to add the following key-value pair into your Info.plist file inside the ios/Runner folder in your project.

<key>NSMotionUsageDescription</key>
<string>A reason to get the permission</string>

How to use

You can check if the device is capable of using the compass.

bool isAvailable = await Compass().isCompassAvailable();

Then you can register a new listener for the compass updates.

_compassSubscription =
        Compass().compassUpdates(interval: Duration(milliseconds: 200)).listen((value) {
      setState(() {
        _degrees = value;
      });
    });

Remember to cancel your StreamSubscriptions after you are done with the compass updates.

_compassSubscription.cancel();
Luis Andrés Jara Castillo GitHub avatar
GitHub-Autor

Luis Andrés Jara Castillo ↗

I'm a software engineer graduated from University of La Frontera.

Temuco, Chile
SprachenDartRubyKotlinSwiftObjective-C

Von diesem Repository veröffentlichte Pakete

Verwendete Abhängigkeiten

Abhängigkeiten 3 Einträge

Wie wähle ich ein passendes Repository?

Nach Anwendungsfall filtern, Aktivität vergleichen und vor der Nutzung das Originalprojekt prüfen.

  1. Nach Name, Autor oder Beschreibung suchen und nach Thema eingrenzen.
  2. Sterne, Forks und letzte Pushes vergleichen. Sterne zeigen Interesse, garantieren aber keine Qualität.
  3. Vor der Nutzung README, Lizenz und Issues auf GitHub prüfen.

Quellen und Pflege

“A repository is the most basic element of GitHub.”

GitHub Docs — About repositories ↗