https://github.com/rexios80/polar
This is a Dart plugin wrapper for the Polar SDK on Android and iOS
https://github.com/rexios80/polar
Last synced: about 2 months ago
JSON representation
This is a Dart plugin wrapper for the Polar SDK on Android and iOS
- Host: GitHub
- URL: https://github.com/rexios80/polar
- Owner: Rexios80
- License: bsd-3-clause
- Created: 2021-06-03T13:23:46.000Z (about 4 years ago)
- Default Branch: master
- Last Pushed: 2025-04-08T19:03:16.000Z (about 2 months ago)
- Last Synced: 2025-04-15T11:07:56.920Z (about 2 months ago)
- Language: Dart
- Homepage: https://pub.dev/packages/polar
- Size: 14.5 MB
- Stars: 17
- Watchers: 1
- Forks: 20
- Open Issues: 7
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# polar
Plugin wrapper for the [Polar SDK](https://github.com/polarofficial/polar-ble-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](https://github.com/polarofficial/polar-ble-sdk).
## Getting Started
### Android
android/app/src/main/AndroidManifest.xml:
```xml
```
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:
```ruby
platform :ios, '14.0'
```Info.plist:
```xml
NSBluetoothAlwaysUsageDescription
Used to connect to Polar devices
NSBluetoothPeripheralUsageDescription
Used to connect to Polar devices
UIBackgroundModesbluetooth-central
```
## Usage
```dart
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 {
await polar.sdkFeatureReady.firstWhere(
(e) =>
e.identifier == identifier &&
e.feature == PolarSdkFeature.onlineStreaming,
);
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'));
}
}```