garmin_client 1.0.6

garmin_connect #

A Dart library for interacting with Garmin Connect, for now only get/export functionality and no upload/edit. Available as a dart package at pub.dev.

Garmin Connect does not provide a public API. This tool is simulating a browser, and manually logs onto the Garmin website to scrape activities. Use at your own risk.

Heavily inspired by the excellent Garmin Connect activity backup tool.

Pull requests and issue reports are very welcome!

Usage #

A simple usage example:

import 'package:garmin_client/garmin_client.dart';

main() {
  var garmin_client = GarminClient(MY_USERNAME, MY_PASSWORD);
  await garmin_client.connect();

  // Gets a list of all activity ids, sorted in reverse chronological order
  var activities = await garmin_client.list_activities();

  // Gets the activity summary of the latest activity
  var latest_summary = await garmin_client.get_activity_summary(activities.first);
}

1.0.6 #

  • Increased number of retries and length of retry interval to cope better with bad network conditions.

1.0.5 #

  • Support for extracting heart rate zones from activities

1.0.4 #

  • Automatic retries in case of network failures (up to 3 times with 5 seconds delay)

1.0.3 #

  • Added supporting for getting laps

1.0.2 #

  • Better exception handling

1.0.1 #

  • Tiny fixes reporterd in static analysis

1.0.0 #

  • Initial version. List and get activities. Edits and new uploads are currently not supported.

example/garmin_client_example.dart

import 'package:args/args.dart';
import 'package:garmin_client/garmin_client.dart';

main(List<String> arguments) async {
  final parser = ArgParser()..addOption('username', abbr: 'u')..addOption('password', abbr: 'p');
  final argResults = parser.parse(arguments);

  var garmin_client = GarminClient(argResults['username'], argResults['password']);
  await garmin_client.connect();

  // Gets a list of all activity ids, sorted in reverse chronological order
  var activities = await garmin_client.list_activities();

  print('You\'ve done ${activities.length} activities');

  // Gets the activity summary of the latest activity
  // var latest_summary = await garmin_client.get_activity_summary(activities.first);

  // Gets the activity details of the latest activity
  // var latest_details = await garmin_client.get_activity_details(activities.first);

  // Gets the splits for the latest activity
  // var latest_splits = await garmin_client.get_activity_splits(activities.first);

  // Gets the heart rate zones for the latest activity
  // var latest_hr_zones = await garmin_client.get_activity_hr_zones(activities.first);

  // Gets a list of all cycling activity (any Garmin activity type accepted)
  // var cycling_activities = await garmin_client.list_activities('cycling');
}

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:


dependencies:
  garmin_client: ^1.0.6

2. Install it

You can install packages from the command line:

with pub:


$ pub get

with Flutter:


$ flutter pub get

Alternatively, your editor might support pub get or flutter pub get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:


import 'package:garmin_client/garmin_client.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
33
Health:
Code health derived from static analysis. [more]
99
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
91
Overall:
Weighted score of the above. [more]
64
Learn more about scoring.

We analyzed this package on Aug 18, 2019, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.4.0
  • pana: 0.12.19

Platforms

Detected platforms: Flutter, other

Primary library: package:garmin_client/garmin_client.dart with components: io.

Health issues and suggestions

Document public APIs. (-1 points)

19 out of 19 API elements have no dartdoc comment.Providing good documentation for libraries, classes, functions, and other API elements improves code readability and helps developers find and use your API.

Format lib/garmin_client.dart.

Run dartfmt to format lib/garmin_client.dart.

Maintenance suggestions

The package description is too short. (-9 points)

Add more detail to the description field of pubspec.yaml. Use 60 to 180 characters to describe the package, what it does, and its target use case.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.2.0 <3.0.0
cookie_jar ^1.0.0 1.0.1
dio ^2.1.13 2.1.13
dio_retry ^0.1.8-beta 0.1.8-beta
Transitive dependencies
logging 0.11.3+2
meta 1.1.7
Dev dependencies
pedantic ^1.0.0
test ^1.0.0