Meridian Atlas for Flutter

Turn-by-turn navigation for Flutter apps: routes with lane-level guidance, spoken announcements timed for you (and an opt-in voice to say them), rerouting, free drive with road names and speed limits, the Atlas 3D map, and offline routing. It's a plugin: guidance runs on the Atlas native core it carries for iOS and Android, which also runs GPS while a session is active, so it keeps going with the screen locked and through tunnels.

Requirements

  • Flutter 3.38 or later (Dart 3.10)
  • iOS 15 or later, Android 8.0 (API 26) or later
  • A Meridian Atlas API key (an app key made in Atlas Studio for your bundle ID, package name and signing certificates) and service URL

Install

Until the package is on a registry, unpack the release archive (meridian_atlas-0.1.0-rc.6.tar.gz) next to your app and depend on it by path:

YAML
dependencies:
  meridian_atlas:
    path: ../meridian_atlas

New Flutter apps start below these minimums: set minSdk = 26 in android/app/build.gradle.kts and platform :ios, '15.0' in ios/Podfile.

Permissions

  • iOS: add NSLocationWhenInUseUsageDescription to Info.plist. For guidance with the screen locked, also add the location background mode.
  • Android: the plugin declares location, foreground-service and notification permissions. Ask for ACCESS_FINE_LOCATION and ACCESS_COARSE_LOCATION together at runtime before starting (Android 12 and later ignore a request for fine alone), and on Android 13+ for POST_NOTIFICATIONS, so the "Navigating" notification of the service that keeps guidance running shows.

begin() without location permission throws AtlasNavigationException (or AtlasFreeDriveException) with code location_permission_required (the enum's locationPermissionRequired), and with only approximate location location_accuracy_reduced, on iOS and Android: ask first, then begin. Every error's message says what to fix; Errors has every code.

A first route

Dart
import 'package:meridian_atlas/meridian_atlas.dart';

// forThisApp names your app on every request, so an app key works. The service and map viewer
// default to api. and maps.meridianatlas.dev (not live yet: beta partners pass baseUrl and
// viewerUrl, the addresses Meridian gave them).
final atlas = await AtlasConfiguration.forThisApp(apiKey: apiKey);
final routes = AtlasRoutes.fromConfiguration(atlas);
final navigation = AtlasNavigation(MethodChannelAtlasNavigationBridge(), configuration: atlas); // reroutes and registers its legs itself
await navigation.initialize();

navigation.updates().listen((update) {
  for (final effect in update.effects) {
    // The session rerouted (from the car, facing its way, asked the way the route was): show the new route.
    if (effect.type == AtlasNavigationEffectType.routeReplaced && effect.route != null) showRoute(effect.route!);
  }
});

final route = await routes.route(
  origin: const AtlasCoordinate(-2.2511, 53.4747),
  destination: const AtlasCoordinate(-2.246, 53.4837),
);
await navigation.begin(route.plan);
// route.guidance: the instructions to show. Each update's announcements say what to speak,
// and when: AtlasVoice() says them, or AtlasVoice.custom(speak: …) with your own text-to-speech

What's in it

  • AtlasRoutes: routes from the Atlas service, with structured guidance.
  • AtlasNavigation: route guidance. It reroutes by itself (or with your own routing, rerouting:); updates carry the progress, each new route and the effects your app acts on: pause and resume, arrival.
  • AtlasFreeDrive: the current road and its speed limit, with no destination.
  • AtlasMapView: the Atlas 3D map as a native view, following the car.
  • AtlasOfflineRoutes: routes on an offline package installed on the device (downloads come after launch).
  • AtlasPlaces: autocomplete, text and nearby search, place details and photos.
  • AtlasTraffic: the traffic delay on a route.
  • AtlasRouteMatrix: distances and driving times between many origins and destinations.
  • AtlasMultiStop: one route through several stops, in order.
  • AtlasCarScreen: CarPlay and Android Auto. The car screen is native and gets navigation updates natively; the CarPlay and Android Auto guide (docs/sdk/car-screens.md) has the Info.plist and manifest entries.
  • AtlasRouteSimulator: drives a navigation session along a route, for testing and app review.

The service clients throw AtlasException, with the same code on every Atlas SDK (missing_api_key, invalid_api_key, capability_required, rate_limit, network_error, outside_coverage, …), a message that says what to fix, and isRetryable; navigation throws AtlasNavigationException and free drive AtlasFreeDriveException, with the same snake_case codes as every other Atlas SDK (code.wire: invalid_request, location_permission_required, location_accuracy_reduced, native_error, …; the enum names are camelCase), never a PlatformException. Listen to updates() as often as you like (guidance and the map, say): listeners share one native subscription, and an update that can't be read is an error event while the stream carries on, so listen with onError. Each feature is turned on per API key.

Licence

Copyright Meridian. All rights reserved. Use is subject to your Meridian Atlas agreement.

Proposal · draft