FLUTTER ECOSYSTEM

Rexios80/polar

이것은 Android 및 iOS용 Polar SDK의 Dart 플러그인 래퍼입니다

극지 프로젝트 이미지
Stars
22
Forks
33
최근 푸시(UTC)
2026. 9. 9.
프로젝트 상태
활성
Rexios GitHub avatar
GITHUB User

Rexios ↗

I do things sometimes

@IO-Design-Team
언어DartSwiftKotlinRubyShellObjective-C

이 저장소가 배포한 패키지

사용 중인 의존성

의존성 목록 12 개

원본 README

아래는 영문 원문 스냅샷입니다. 최신 내용은 GitHub에서 확인하세요.

README 펼치기 / 접기

polar

Plugin wrapper for the Polar SDK

Note

This is an unofficial wrapper for the Polar SDK. For any questions regarding the underlying SDKs or Polar devices in general, please see the official repository.

Getting Started

Android

android/app/src/main/AndroidManifest.xml:

<uses-permission android:name="android.permission.BLUETOOTH_SCAN" android:usesPermissionFlags="neverForLocation" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" android:maxSdkVersion="30" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" android:maxSdkVersion="30" />

If you use BLUETOOTH_SCAN to determine location, remove android:usesPermissionFlags="neverForLocation"

If you use location services in your app, remove android:maxSdkVersion="30" from the location permission tags

iOS

Change the deployment target in Xcode to iOS 14+

Podfile:

platform :ios, '14.0'

Info.plist:

<key>NSBluetoothAlwaysUsageDescription</key>
<string>Used to connect to Polar devices</string>
<key>NSBluetoothPeripheralUsageDescription</key>
<string>Used to connect to Polar devices</string>
<key>UIBackgroundModes</key>
<array>
  <string>bluetooth-central</string>
</array>

Usage

import 'package:flutter/foundation.dart';
import 'package:polar/polar.dart';

const identifier = '1C709B20';
final polar = Polar();

void example() {
  polar.connectToDevice(identifier);
  streamWhenReady();
}

void streamWhenReady() async {
  final readiness = await polar.sdkFeaturesReadiness.firstWhere(
    (e) => e.identifier == identifier,
  );
  if (!readiness.ready.contains(PolarSdkFeature.onlineStreaming)) {
    return;
  }

  final availabletypes = await polar.getAvailableOnlineStreamDataTypes(
    identifier,
  );

  debugPrint('available types: $availabletypes');

  if (availabletypes.contains(PolarDataType.hr)) {
    polar
        .startHrStreaming(identifier)
        .listen((e) => debugPrint('HR data received'));
  }
  if (availabletypes.contains(PolarDataType.ecg)) {
    polar
        .startEcgStreaming(identifier)
        .listen((e) => debugPrint('ECG data received'));
  }
  if (availabletypes.contains(PolarDataType.acc)) {
    polar
        .startAccStreaming(identifier)
        .listen((e) => debugPrint('ACC data received'));
  }
}