cldf 1.0.0 copy "cldf: ^1.0.0" to clipboard
cldf: ^1.0.0 copied to clipboard

A Dart implementation of the Crushlog Data Format (CLDF) for climbing data exchange.

CLDF - Crushlog Data Format for Dart #

Dart CI pub package Coverage Status Quality Gate Status

A Dart implementation of the Crushlog Data Format (CLDF) for climbing data exchange.

Features #

  • Read and write CLDF archives (.cldf files)
  • JSON serialization/deserialization for all CLDF models
  • Type-safe Dart models for all CLDF entities
  • Archive creation with automatic checksums
  • Validation support

Installation #

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

dependencies:
  cldf: ^1.0.0

Usage #

Reading a CLDF archive #

import 'package:cldf/cldf.dart';

final reader = CLDFReader();
final archive = await reader.readFile('path/to/file.cldf');

// Access data
print('Locations: ${archive.locations.length}');
print('Routes: ${archive.routes.length}');
print('Climbs: ${archive.climbs.length}');

Writing a CLDF archive #

import 'package:cldf/cldf.dart';

final archive = CLDFArchive(
  manifest: Manifest(
    version: '1.0.0',
    format: 'CLDF',
    creationDate: DateTime.now(),
    platform: Platform.mobile,
    appVersion: '1.0.0',
  ),
  locations: [
    Location(
      id: 1,
      name: 'Test Crag',
      country: 'USA',
      isIndoor: false,
    ),
  ],
  routes: [
    Route(
      id: 1,
      locationId: 1,
      name: 'Classic Route',
      routeType: RouteType.route,
      grades: {'french': '6a'},
    ),
  ],
  climbs: [
    Climb(
      id: 1,
      date: DateTime.now(),
      routeName: 'Classic Route',
      type: ClimbType.route,
      finishType: FinishType.redpoint,
      attempts: 2,
    ),
  ],
);

final writer = CLDFWriter();
await writer.writeFile('output.cldf', archive);

Working with JSON #

All models support JSON serialization:

// Convert to JSON
final climbJson = climb.toJson();

// Parse from JSON
final climb = Climb.fromJson(jsonData);

Models #

The package provides models for all CLDF entities:

  • Manifest - Archive metadata
  • Location - Climbing locations
  • Sector - Sectors within locations
  • Route - Routes and boulders
  • Climb - Individual climb records
  • Session - Climbing sessions
  • Tag - Tags for categorization

Contributing #

Contributions are welcome! Please feel free to submit a Pull Request.

License #

This project is licensed under the MIT License - see the LICENSE file for details.

0
likes
0
points
124
downloads

Publisher

unverified uploader

Weekly Downloads

A Dart implementation of the Crushlog Data Format (CLDF) for climbing data exchange.

Homepage
Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

archive, collection, crypto, intl, json_annotation, meta

More

Packages that depend on cldf