Dart SDK

The released dartstream_client package is version 0.3.3, published on 20 October 2026. Use the API reference for that published version.

Install

dart pub add dartstream_client:0.3.3

Match your code to the API exported by the installed version. A successful package installation does not establish managed-runtime credentials, project access or a working provider connection.

Server Setup and Project Flags

Create your workspace and project at DartStream. Create a project-bound machine credential with flags:read and place these three variables in your trusted server’s environment: DARTSTREAM_CLIENT_ID, DARTSTREAM_CLIENT_SECRET and DARTSTREAM_PROJECT_ID. Keep the one-time secret out of source control, browser/mobile builds, screenshots and command history. The tenant is derived from the exchanged token; optional DARTSTREAM_TENANT_ID must match that tenant when supplied.

Use this complete Dart console program:

import 'package:dartstream_client/dartstream_server.dart';

Future<void> main() async {
  final machine = DartStreamMachineClient.fromEnvironment();
  try {
    final flags = await machine.listFeatureFlags();
    print('Read ${flags.length} project flags.');
  } finally {
    machine.close();
  }
}

fromEnvironment() selects production by default. Run this on your trusted server with dart run, then compare the returned count with that project’s Feature Flags page. A successfully loaded empty project returns zero flags. Tokens last 300 seconds; the client renews before expiry and shares concurrent exchanges. Failed mutations are never automatically replayed.

Account and Data Boundaries

Verify account, tenant, project and environment access for each service operation. Treat 401 as authentication failure and 403 as denied scope or project access. Investigate failed mutations before submitting them again; do not assume they were never saved.

Managed experience uses durable PostgreSQL storage on development and production. Data is isolated by tenant, project and player. A new player starts with an empty profile, inventory, cloud save and sessions. Inventory grant and consume require an idempotencyKey; attempts to overspend return HTTP 409. Give the machine client experience:read and experience:write for the complete experience workflow. This managed-service behavior does not turn local sample adapters into durable storage.

The managed streaming implementation supports DartStream Core. External broker connectivity is not provided by that implementation.

Browser, Mobile and Games

Never embed a client secret in browser JavaScript, a mobile binary or Flutter --dart-define values. Use your own trusted backend to verify the player’s Firebase ID token and derive the player ID. Expose narrow game operations rather than a generic service proxy.

See the game authentication contract for the account boundary. A configured application backend is required; there is no enabled public-client grant.