搜索插件、代码仓与 APP 分类

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 ↗