Search packages, repositories and app categories

Package detailsv7.12.0

polar

This is a Dart plugin wrapper for the Polar SDK on Android and iOS

AndroidiOS
30-day downloads
1.9K
Likes
22
Pub points
160

Install package

flutter pub add polar

Package Overview

Package selection guidance compiled from public package information, community data, and project usage.

The polar package is a Dart plugin wrapper for the Polar SDK, enabling Flutter applications to integrate with Polar's health and fitness devices on both Android and iOS platforms. It provides access to real-time heart rate data, device connectivity, and user activity tracking through a unified API. Designed for developers building fitness or wellness apps, it simplifies communication with Polar hardware, ensuring seamless data synchronization and device management. The package supports native SDK functionality while maintaining cross-platform compatibility.

Use cases

  • Integrating real-time heart rate monitoring
  • Connecting to Polar wearable devices
  • Tracking user physical activity
  • Building fitness tracking applications
  • Enabling device pairing in health apps

Key features

  • Cross-platform support (Android & iOS)
  • Real-time heart rate data access
  • Device connection and management
  • Simple integration with Flutter apps
  • Native SDK abstraction via Dart

Suitable for

  • Fitness app developers
  • Wearable health application creators
  • Mobile developers working with Polar devices
  • Health data integrators
  • Flutter projects requiring biometric sensors

Considerations

  • Requires compatible Polar devices
  • Limited to Polar SDK features
  • Needs proper permissions on Android and iOS
  • Dependent on external SDK updates
  • May require additional configuration for background operations

Original README

Original README snapshot from the linked source repository. Visit the repository for the latest content.

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'));
  }
}

Categories

Dependencies

Dependency list 6 items

Source repository

Projects using this package

No data available yet.