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_clientOr for Flutter:
bash
flutter pub add your_org_api_clientOptions
| Option | Values | Default |
|---|---|---|
| Client style | functions, namespaced, class, class-namespaced | functions |
| Argument style | object, positional | object |
| Namespace | tags, path | tags |
| Doc comments | full, minimal | full |
| File header | omit, include | omit |
| Usage example | full, concise | full |
Package name
pub.dev names are global, lowercase, and use underscores. Hyphens are not allowed:
text
acme_apipub.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.