Octri

Languages

Dart

The Dart SDK publishes to pub.dev, and works in both Dart and Flutter projects.

Install

bash
dart pub add your_org_api_client

Or for Flutter:

bash
flutter pub add your_org_api_client

Options

OptionValuesDefault
Client stylefunctions, namespaced, class, class-namespacedfunctions
Argument styleobject, positionalobject
Namespacetags, pathtags
Doc commentsfull, minimalfull
File headeromit, includeomit
Usage examplefull, concisefull

Package name

pub.dev names are global, lowercase, and use underscores. Hyphens are not allowed:

text
acme_api
pub.dev scores your package publicly

Every package gets a pub points score covering documentation, static analysis, and platform support, shown on the listing. Doc comments set to full and a real README both feed it. A low score is the first thing a prospective user sees.

Versions are permanent

pub.dev lets you retract a version within 7 days, which discourages resolution but does not free the number, and the name is yours for good. See Publishing.

What callers write

dart
import 'package:acme_api/acme_api.dart';

final client = AcmeClient(token: Platform.environment['ACME_TOKEN']!);

await for (final user in client.users.list(limit: 100)) {
  print(user.id);
}

Source maps

Dart minifies for release builds, so production stack traces need source maps uploaded the same way JavaScript does. See Source maps.