nativ_maps_flutter library

Amazon Location Service, shaped like Google Maps.

A MapLibre map widget with markers, polylines, polygons, circles, clusters, heatmaps and offline regions, plus the 17 operations of Places, Routes and Maps re-exported from the core.

import 'package:nativ_maps_flutter/nativ_maps_flutter.dart';

final maps = NativMaps(
  region: 'us-east-1',
  credentials: const ApiKeyCredentials('...'),
);

NativMap(
  styleUrl: maps.maps.styleDescriptorUrl(MapStyle.standard)!,
  initialCameraPosition: CameraPosition(
    target: LatLng(-0.1807, -78.4678),
    zoom: 13,
  ),
  onMapCreated: (c) => controller = c,
);

Installing just this package already gets you the 17 operations: it re-exports all of nativ_maps.

The rule that sums it up

If you know how to use google_maps_flutter, you already know how to use half of this without reading anything. And the other half is what Google didn't give you: isochrones, snap to roads, stop optimization, toll costs and offline maps.

Classes

AcceptanceForecast
How many drivers would accept an amount, and who would arrive first.
AccessPoint
A point through which you enter or leave a place.
Address
A complete postal address, as Amazon Location v2 breaks it down.
AddressComponents
The components of an address, for geocoding field by field.
AdminArea
An administrative division with a code and a name: province, canton, parish, depending on the level.
AlsBytes
Bytes with their content type, what GetStaticMap returns.
ApiKeyCredentials
Authentication with an Amazon Location API key.
AutocompleteSuggestion
An autocomplete suggestion.
BatchItemError
A per-item error in a batch operation.
BatchResult
The result of a batch operation.
BidAdvisor
Decides whether a bid is good for the driver.
BidEvaluation
The analysis of whether a ride is good for the driver.
BidRanking
How the bids the passenger sees are sorted.
BillingUnits
How many billing units each operation costs.
BitmapDescriptor
A marker's icon.
Budget
Spending cap per time window, checked before sending.
CameraPosition
Where the map camera is.
CameraUpdate
A camera move command.
Circle
A circle with a radius in meters.
CircleId
A circle's identifier.
Cluster
A cluster of markers, as it's tapped on the map.
ClusterManager
Groups nearby markers into a single symbol with the count.
ClusterManagerId
A marker cluster manager's identifier.
ContactDetail
A way to get in touch: phone, website, email or social network.
Contacts
A place's contacts, grouped by type.
Country
A country, with its two ISO codes and its name.
Credentials
How a request to Amazon Location is authenticated.
DemandSignal
A named demand pressure, so the breakdown can be explained.
DevicePosition
A device's position, as returned by the service.
DevicePositionUpdate
A device's position, as it's sent to the service.
DirectCredentials
Convenient base for writing your own Credentials.
DispatchPlanner
Chooses which drivers to offer a ride to.
DownloadProgress
How a region's download is going.
DriverBid
A driver's bid on a request.
DriverCandidate
A candidate driver for a pickup.
DriverEconomics
The real costs of driving, to decide whether a ride is worth it.
DriverLocation
Where a driver is.
DriverOptions
The driver's mandatory rest breaks, for optimizeWaypoints.
DrivingEvent
A driving event, with where and when it happened.
DrivingScore
The driving score of a trip or of a driver.
FareBreakdown
The fare of a trip, broken down.
FareLine
One line of the fare breakdown.
FareSample
A price observed on the street, to fit the tariff against.
FilterResult
The result of passing a fix through the filter.
ForecastedGeofenceEvent
A geofence event that hasn't happened yet.
ForecastGeofenceEventsResponse
The forecastGeofenceEvents response.
Geofence
A stored geofence.
GeofenceCollection
A geofence collection.
GeofenceGeometry
The shape of a geofence: a circle, a polygon or several polygons.
GeofencePage<T>
A page of geofences or collections.
GeofencingClient
The 12 Amazon Location geofencing operations.
GlidePolicy
When a new position is animated, and for how long.
GroundOverlay
An image pinned to a rectangle of the map.
GroundOverlayId
A ground overlay's identifier.
HeaderCredentials
Authentication with headers produced by a function of yours.
Heatmap
A heatmap.
HeatmapId
A heatmap's identifier.
Highlight
Which part of the search text matched which part of the result.
InfoWindow
The info window that pops up when a marker is tapped.
Isoline
An isoline: the polygon of what is reachable within a threshold.
IsolineGranularity
How much detail an isoline's polygon has.
IsolineResponse
The response of calculateIsolines.
LatLng
A geographic point: latitude and longitude in decimal degrees.
LatLngBounds
A geographic rectangle, defined by its southwest and northeast corners.
MapsClient
The Amazon Location Maps v2 operations.
Marker
A marker on the map.
MarkerHue
The named hues of google_maps_flutter, so migrated code compiles without looking up the numbers.
MarkerId
A marker's identifier. Same name as in google_maps_flutter.
MarkerPose
Where a marker is drawn and which way it faces.
MarketConditions
The state of the market at request time.
MatrixCell
A cell of the origin-destination matrix.
MinMaxZoomPreference
How far the map can be zoomed in and out.
MotionMath
The math behind smooth marker transitions.
NativMap
The map widget.
NativMapController
The remote control for the map.
NativMaps
The gateway to Amazon Location's 44 operations.
NativOfflineManager
Downloads and manages maps for offline use.
OfflineRegion
A map region stored on the device.
OpeningHours
A place's opening hours, including whether it's open now.
OpeningHoursComponent
A time slot in machine-readable format.
OptimizationWaypoint
A stop to visit, for optimizeWaypoints.
OptimizedWaypoint
A stop already placed in its slot within the optimal route.
PathMatch
The result of projecting a point onto a path.
PatternItem
A piece of a dashed line's pattern.
Place
A search or geocoding result.
PlaceCategory
A point-of-interest category: "restaurant", "gas station", "hospital".
PlacesClient
The seven Amazon Location Places v2 operations.
PlaceSearchResponse
A page of search results.
Polygon
A closed area on the map.
PolygonId
A polygon's identifier.
Polyline
A line on the map.
PolylineId
A polyline's identifier.
PositionFilter
Discards GPS fixes that do not represent real movement.
PositionFix
A raw GPS fix, exactly as the device delivers it.
PositionVerification
The result of checking whether a position can be trusted.
PriceAdvisor
Calculates the suggested price of a ride in a bidding market.
PriceFactor
A factor that moved the suggested price, and by how much.
ProxyCredentials
Authentication delegated to your own backend, which signs with SigV4.
QueryRefinement
A proposed rewrite of what was searched for.
RideAuction
The auction for a ride: collects bids and lets one be chosen.
RideRequest
A passenger's request, with the price they propose.
Route
A complete route between an origin and a destination.
RouteAvoidance
What to avoid when calculating the route.
RouteGeometry
The geometry of a leg, whether it comes as a list of points or as a polyline.
RouteIncident
An incident on the route: roadworks, accident, closure.
RouteLeg
A leg of the route: the stretch between two consecutive stops.
RouteMatrix
The response of calculateRouteMatrix.
RouteProgress
Where the vehicle is along a calculated route.
RouteResponse
The response of calculateRoutes.
RoutesClient
The five operations of Amazon Location Routes v2.
RouteTracker
Follows a vehicle along a route, without spending requests.
SearchFilter
How a search is narrowed down: by rectangle, by circle, by country, or by several of them at once.
SnappedTracePoint
A trace point already snapped to the street.
SnapToRoadsResponse
The response of snapToRoads.
StopPeriod
A period during which the vehicle was stopped.
StreetComponent
One piece of a street name, already split out.
StyleEditor
Tweaks the map style at runtime.
StyleLayer
A style layer, with what you need to tweak it.
SuggestedPrice
The suggested price for a ride, shaped the way inDrive does it.
SuggestResponse
The suggest response, with its refinements.
SuggestResult
An item in the suggest response.
Surcharge
A fixed charge added to the trip.
Tariff
A taxi or private-hire tariff, and the engine that applies it.
TariffBand
A time band with its own surcharge.
TariffCalibration
Fits a tariff to the prices you already see on the street.
TariffFit
The result of fitting a tariff to observed prices.
TelemetryAnalyzer
Detects harsh acceleration, harsh braking, harsh cornering and speeding.
Thresholds
The thresholds of an isoline: by time, by distance, or both.
TileOverlay
A layer of your own tiles on top of the map.
TileOverlayId
A tile layer's identifier.
TimeZoneInfo
A place's time zone.
Toll
A toll on the route.
TracePoint
A point of a GPS trace, as sent to snapToRoads.
Tracker
A tracker: the resource where positions are stored.
TrackingClient
The 15 device tracking operations of Amazon Location.
TrackingPage<T>
A page of positions or trackers.
TransportOptions
Network settings shared by the three clients.
TravelModeOptions
The vehicle's characteristics, which change the route.
TravelStep
A navigation step.
TripRecorder
Turns a stream of GPS positions into a measurable trip.
TripSummary
A finished trip, with everything needed to charge for it and to defend it.
TripUpdate
The state of the trip after processing a fix.
WaypointConnection
The connection between two consecutive stops of the optimal route.
WaypointOptimizationResponse
The response of optimizeWaypoints.
WiFiAccessPoint
A Wi-Fi access point seen by the device, to verify its position.

Enums

AlsService
The three Amazon Location v2 services.
AuctionState
What state an auction is in.
BudgetPolicy
What to do when the budget runs out.
Cap
How a polyline ends.
DrivingEventType
What kind of driving event was detected.
FareRounding
How the final amount is rounded.
FixRejection
Why a fix was discarded.
ForecastedEventType
What's going to happen to a device with respect to a geofence.
GeometryFormat
Format in which the geometry of a route or an isoline arrives.
IntendedUse
Whether the result is going to be stored in your own infrastructure.
JointType
How two segments of a polyline are joined.
MapBuildings
How buildings are drawn.
MapColorScheme
Map tone.
MapContourDensity
Density of contour lines.
MapPoiCategory
Point-of-interest categories that are drawn.
MapPoiDensity
How many points of interest are drawn.
MapStyle
Catalog of Maps v2 map styles.
MapTerrain
How terrain relief is drawn.
MapTraffic
Real-time traffic drawn inside the style.
MapTravelMode
Additional information for a mode of transport, drawn in the style.
MyLocationTracking
Whether the camera follows the user's location, and how.
PlaceFeature
Extra data that can be requested in a Places operation.
PlaceType
What kind of place a result is.
PositionFiltering
How the tracker decides which positions to store.
PostalCodeMode
How postal codes are handled in an autocomplete.
RouteFeature
Extra data that can be requested per route leg.
RouteOptimization
What is optimized when calculating a route.
ScaleBarUnit
Unit of a static map's scale bar.
StyleLayerType
What kind of layer it is, within a MapLibre style.
SuggestResultType
What kind of suggestion suggest returned.
TrafficUsage
How traffic information is used when calculating.
TravelMode
Travel mode for the Routes operations.
TravelStepType
What a route's steps look like.
WaypointOptimization
What is optimized when reordering the stops in optimizeWaypoints.

Constants

earthRadiusMeters → const double
Mean Earth radius in meters, the value Amazon Location uses.

Functions

crossTrackMeters(LatLng point, LatLng start, LatLng end) → double
The perpendicular distance from point to the segment start–end.
cumulativeDistances(List<LatLng> path) → List<double>
The cumulative distance up to each point of the path.
decodeFlexiblePolyline(String encoded) → List<LatLng>
Decodes HERE's Flexible Polyline format, which is what Amazon Location v2 returns when you ask for GeometryFormat.flexiblePolyline.
decodeGooglePolyline(String encoded, {int precision = 5}) → List<LatLng>
Decodes Google's encoded polyline format.
encodeFlexiblePolyline(Iterable<LatLng> points, {int precision = 5}) → String
Encodes a list of points in HERE's Flexible Polyline format.
interpolateOnPath(List<LatLng> path, double alongMeters, {List<double>? cumulative}) → LatLng
The point that lies alongMeters from the start of the path.
nearestPointOnPath(List<LatLng> path, LatLng point, {int fromIndex = 0, int? maxSegments, List<double>? cumulative}) → PathMatch
Finds the point on the path closest to point.
pathLength(List<LatLng> path) → double
The total length of a path, in metres.
simplifyPath(List<LatLng> path, {required double toleranceMeters}) → List<LatLng>
Trims a path while keeping its shape, with Douglas–Peucker.

Exceptions / Errors

AlsApiException
The service responded, but with an error.
AlsParseException
The response arrived with a 200 but could not be interpreted.
AlsParseExceptionForMatrix
The matrix arrived with different dimensions from the ones requested.
AlsTransportException
The service could not be reached: no network, DNS down, TLS rejected or every attempt timed out.
BudgetExhaustedException
The spending cap configured in Budget was reached.
NativMapsConfigurationException
Configuration is missing to be able to call the service.
NativMapsException
Root of everything this package throws on purpose.