패키지, 저장소 및 앱 카테고리 검색

패키지 상세v0.1.1

flutter_sensor_compass

기기의 자기 북쪽에 대한 방향(도 단위)을 얻는 플러그인입니다.

30일 다운로드
32
좋아요
3
Pub 점수
40

패키지 설치

flutter pub add flutter_sensor_compass

패키지 개요

공개 정보를 바탕으로 생성한 선택 가이드입니다.

flutter_sensor_compass 패키지는 장치의 컴пас 센서에 간단하게 접근할 수 있는 방법을 제공하며, 자기 북쪽을 기준으로 실시간 방향 데이터(도 단위)를 제공합니다. 앱이 장치의 방향을 감지할 수 있게 해주어 내비게이션, 증강현실 및 위치 기반 서비스에 이상적입니다. 이 플러그인은 장치 내장된 자력계를 활용하여 작동하며, Flutter 애플리케이션에 원활하게 통합되도록 설계되었습니다. 백그라운드 업데이트를 지원하고 최소한의 구성으로 정확한 측정값을 제공합니다. 개발자는 방향 변화에 쉽게 구독하고 적절히 반응할 수 있습니다.

사용 사례

  • 내비게이션 앱
  • 증강현실 경험
  • 위치 기반 게임
  • 야외 활동 추적
  • 지도 방향

주요 기능

  • 실시간 나침반 데이터
  • 자기 북쪽 방향
  • 백그라운드 센서 업데이트
  • 간단한 API 통합
  • 크로스 플랫폼 지원

적합한 대상

  • 내비게이션 도구를 개발하는 개발자
  • 기기 방향 감지를 요구하는 앱
  • AR 및 VR 애플리케이션
  • 피트니스 및 아웃도어 추적 앱

고려 사항

  • 자기계 센서를 갖춘 장치가 필요합니다
  • 정확성을 위해 캘리브레이션이 필요할 수 있습니다
  • 센서가 없는 장치에서는 제한됨
  • 지속적인 폴링으로 인한 배터리 사용
  • 근접한 자기 간섭으로 인해 정확도에 영향을 받음

원본 README

연결된 소스 저장소의 README 원문 스냅샷입니다. 최신 내용은 저장소에서 확인하세요.

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();

카테고리

의존성

의존성 목록 2 개

소스 저장소

이 패키지를 사용하는 프로젝트

아직 데이터가 없습니다.