MapRoute class

A route handed to a map content block at runtime.

Return one of these from AppDNAOnboardingDelegate.onBeforeStepRender, keyed by the map block's id, and the block draws it instead of its authored stops:

@override
Future<Map<String, dynamic>?> onBeforeStepRender(
  String flowId, String stepId, int stepIndex, String stepType,
  Map<String, dynamic> responses,
) async {
  final route = await myRoutingService.routeForCurrentOrder();
  return {
    'mapRoutes': {
      'delivery_map': MapRoute(
        polyline: route.encodedPolyline,
        stops: [
          MapRouteStop(lat: 52.2297, lng: 21.0122, title: 'Warehouse'),
          MapRouteStop(lat: 52.4064, lng: 16.9252, title: 'You'),
        ],
      ).toMap(),
    },
  };
}

This is the only route source that can answer "where is it right now": authored stops are fixed at publish time, and a template variable can only carry what the flow already knows.

A pure data shape, per ADR-001 — the rendering, the URL composition and the merge all happen in the native core, so a Flutter host's map is byte-for-byte the map an iOS host's is.

Constructors

MapRoute({String? polyline, List<MapRouteStop> stops = const []})
const

Properties

hashCode → int
The hash code for this object.
no setterinherited
polyline → String?
Google's encoded-polyline format, which is what every routing service returns.
final
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
stops → List<MapRouteStop>
The points to mark. Ordering is the route's order — stop 1 is the first pin.
final

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toMap() → Map<String, dynamic>
The bridge shape the native decoder reads. Keys are part of the contract and pinned by the map_delegate_route shared fixture, so renaming one here fails a test rather than silently leaving every Flutter host's map on its authored route.
toString() → String
A string representation of this object.
inherited

Operators

operator ==(Object other) → bool
The equality operator.
inherited