Documentation menu

SDKs

Dart & Flutter SDK

The official Wayline SDK for Dart & Flutter: Dart 3 servers and CLIs. For Flutter apps, call your own backend — never ship a Wayline key in an app.

Install

pub.dev
dart pub add wayline

Quickstart

Set WAYLINE_API_KEY to a test key (see the Quickstart), then:

Dart & Flutter
import 'dart:io';
import 'package:wayline/wayline.dart';

Future<void> main() async {
  final wayline = Wayline(apiKey: Platform.environment['WAYLINE_API_KEY']!);
  final d = await wayline.distance(
    origin: LatLng(23.7925, 90.4078),
    destination: LatLng(23.733, 90.4172),
    units: Units.imperial,
  );
  print('${d.distanceMiles} mi, ${d.durationSeconds} s');
  wayline.close();
}

Errors

Non-2xx responses raise a typed error after retries are exhausted. Branch on code — the full list is in the error reference.

Error handling
try {
  await wayline.distance(origin: LatLng(0, 0), destination: LatLng(0, 1));
} on WaylineException catch (e) {
  print('${e.code} ${e.status} ${e.requestId}');
}

Configuration

OptionDefaultDescription
API keyWAYLINE_API_KEYYour live or test key. Never logged.
Base URLhttps://api.wayline.cloudOverride for staging or a proxy.
Timeout30 secondsPer attempt.
Max retries3For 429 and 5xx, with exponential backoff + jitter, honoring Retry-After.

Source and releases

Package: wayline on pub.dev. Source: packages/sdk-dart. Versions follow semantic versioning; see the CHANGELOG in the package and our product changelog.

Was this page helpful?