activity_files
0.8.5, released 4 weeks ago by eikedreier.com
Toolkit for parsing, editing, validating, and converting workout activity files in GPX, TCX, FIT, GeoJSON, and CSV.
What it does
Provides a pure Dart toolkit and command-line tool to parse, normalize, validate, edit, and convert workout activity files across GPX, TCX, FIT, GeoJSON, and CSV formats. It includes stream-aware builders, point-level editing, multi-sport workflows, and robust error diagnostics.
AI-written summary of version 0.8.5, based on the package's README and metadata. Report an inaccuracy
Use it when
- You need to parse, edit, or convert workout files like GPX, TCX, or FIT in a Dart or Flutter application.
- You want a format-agnostic model for GPS points, laps, and sensor channels.
- You need detailed diagnostic messages instead of parser crashes when handling malformed activity files.
Skip it when
- You are working with file formats completely unrelated to workout or fitness tracking activities.
- You need a full-featured mapping SDK rather than a file parsing/conversion toolkit.
Strengths
- Supports multiple popular activity file formats including GPX, TCX, FIT, GeoJSON, and CSV.
- Parsers are designed never to throw on malformed files, reporting issues as structured diagnostics.
- Includes multi-sport split/merge workflows and point-level editing capabilities.
Weaknesses
- Payloads and streams over 64MB require explicit isolate usage or streaming APIs.
- Strict FIT integrity checks require specific import configurations.
Setup
- Kind
- Pure Dart
- Effort
- Low
- Code generation
- No
- Direct dependencies
- 4
Pure Dart library; add to pubspec.yaml dependencies.
import 'package:activity_files/activity_files.dart';
Future<void> convertGpxToFit(Uint8List bytes) async {
final imported = await ActivityFiles.import(bytes, useIsolate: true);
if (imported.hasErrors) {
throw StateError('Import failed:\n${imported.diagnosticsSummary()}');
}
final normalized = ActivityFiles.edit(imported.activity).sortAndDedup().trimInvalid().activity;
final export = ActivityFiles.export(activity: normalized, to: ActivityFileFormat.fit, runValidation: true);
final fitBytes = export.asBytes();
}Alternatives
Packages that do the same job and could replace activity_files.
- tar
Memory-efficient, streaming implementation of the tar file format
90Compare - file_selector_macos
macOS implementation of the file_selector plugin
82Compare - syncfusion_flutter_pdf
Native Dart library for creating, reading, editing, and securing PDF files.
89Compare - flutter_downloader
Plugin to create and manage background download tasks on Android and iOS.
80Compare
Works with
Packages commonly used together with activity_files: ones it builds on, ones built on it, and its own family.
- xmlactivity_files depends on itFull-featured XML and XPath library for DOM parsing, SAX streaming, and fluent building.
- argsactivity_files depends on itLibrary for parsing raw command-line arguments into options and values using GNU and POSIX styles.
- csvactivity_files depends on itParse and generate CSV strings with stream support and Excel compatibility.