パッケージ、リポジトリ、アプリカテゴリを検索

GitHub リポジトリLJaraCastillo/flutter_sensor_compass

flutter_sensor_compass

デバイスの磁気北極に対する方位(度単位)を取得するプラグイン。

flutter_sensor_compass のプロジェクト画像
スター
1
フォーク
1
最終プッシュ(UTC)
2019/11/26
プロジェクト状態
公開中

元の README

以下は英語原文のスナップショットです。最新版は 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 作者

Luis Andrés Jara Castillo ↗

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

Temuco, Chile
言語DartRubyKotlinSwiftObjective-C

このリポジトリが公開するパッケージ

使用している依存関係

依存関係一覧 3 件

プロジェクトに合うリポジトリを選ぶには?

用途で絞り込み、開発状況を比較し、採用前に元のリポジトリで要件を確認しましょう。

  1. 名前・作者・説明で検索し、技術トピックで絞り込みます。
  2. スター、フォーク、最近のプッシュを比較します。スターは関心の目安であり、品質の保証ではありません。
  3. 利用前に GitHub で README、ライセンス、Issues を確認します。

情報源と管理

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

GitHub Docs — About repositories ↗