fiveesrd 0.1.3 copy "fiveesrd: ^0.1.3" to clipboard
fiveesrd: ^0.1.3 copied to clipboard

Umbrella package that re-exports the FiveEsrd models, client, and datastore.

example/main.dart

import 'package:fiveesrd/fiveesrd.dart';

/// Simple console example showing how to use both the REST and GraphQL helpers.
Future<void> main() async {
  final client = FiveEsrdClient(options: ClientOptions(enableLogging: false));
  final datastore = FiveEsrdDatastore.fromClient(client);

  // Fetch a few level-1 spells via the REST API.
  final spells = await client.rest.listSpells(query: {'level': 1});
  final firstRestResult = spells.results?.first;
  if (firstRestResult != null) {
    print('First level-1 spell: ${firstRestResult.name}');
  }

  // Fetch monster summaries via GraphQL.
  final monsters = await client.graphql.monstersOverview(limit: 3);
  for (final monster in monsters.monsters) {
    final armorClass = monster.armorClass.isNotEmpty
        ? monster.armorClass.first.value
        : null;
    print('Monster ${monster.name} has AC ${armorClass ?? 'n/a'}');
  }

  // Fetch and cache a class detail via the datastore layer.
  final fighter = await datastore.getClass('fighter');
  print('Datastore cached class: ${fighter.name}');
}
0
likes
150
points
16
downloads

Publisher

verified publisherundrapps.com

Weekly Downloads

Umbrella package that re-exports the FiveEsrd models, client, and datastore.

Repository (GitHub)
View/report issues
Contributing

Documentation

API reference

License

MIT (license)

Dependencies

fiveesrd_client, fiveesrd_datastore, fiveesrd_models

More

Packages that depend on fiveesrd