bgg_flutter_client 0.0.3 copy "bgg_flutter_client: ^0.0.3" to clipboard
bgg_flutter_client: ^0.0.3 copied to clipboard

A lightweight Dart client for the BoardGameGeek XML API2.

example/main.dart

import 'package:bgg_flutter_client/src/bgg_client.dart';
import 'package:bgg_flutter_client/src/core/exceptions/bgg_exceptions.dart';
import 'package:flutter/foundation.dart';

void main() async {
  final client = BggClient();

  try {
    final collection = await client.getCollection(userName: 'username');

    for (final item in collection.items) {
      debugPrint('${item.name} (${item.yearPublished}) - Played ${item.numPlays} times');
    }
  } on BggTimeoutException {
    debugPrint('Request timed out.');
  } on BggServerException catch (e) {
    debugPrint('Server error: ${e.message}');
  } on BggParsingException {
    debugPrint('Failed to parse XML response.');
  } catch (e) {
    debugPrint('Unexpected error: $e');
  }

  final results = await client.search(query: 'Catan');
  for (var r in results.items) {
    debugPrint('${r.name} (ID: ${r.id}) – published ${r.yearPublished}');
  }
}
0
likes
150
points
88
downloads

Publisher

unverified uploader

Weekly Downloads

A lightweight Dart client for the BoardGameGeek XML API2.

Repository (GitHub)

Documentation

API reference

License

BSD-3-Clause (license)

Dependencies

dio, flutter, xml

More

Packages that depend on bgg_flutter_client