Bardiya Map — Flutter SDK
Official Flutter SDK for Bardiya Map. Re-exports
bardiyamap_sdk (Places, Geocoding, Directions, Distance
Matrix, Address Validation, Tracking, History, Realtime SSE, and webhook
verification) alongside the key-free BardiyaMap MapLibre widget, camera
controller (BardiyaMapController), and lifecycle-aware SSE manager
(BardiyaRealtimeController).
Status: published on pub.dev.
flutter analyzeandflutter testpass, andbardiyamap_sdk ^0.1.0resolves from pub.dev.
Install
dependencies:
bardiyamap_flutter: ^0.1.0
import 'package:bardiyamap_flutter/bardiyamap_flutter.dart';
Flutter 3.29 or newer; Dart 3.7 or newer. Uses the official
maplibre_gl 0.27.1 plugin (Android,
iOS and Web) and shares transport, models, auth routing, and SSE parsing with
bardiyamap_sdk.
No API keys in the app
BardiyaMap accepts no API key and registers no native request credential.
assertSafeStyle rejects bdy_live_*, bdy_test_*, and api_key= style URLs
before rendering.
- Maps (
/v1/places,/v1/geocode,/v1/directions,/v1/distance-matrix,/v1/style.json,/v1/tiles): Proxy through your authenticated customer backend. Rewrite everysources.*.url,sources.*.tiles,glyphs, andspriteURL in/v1/style.jsonto public or short-lived signed proxy URLs. - Device Tracking Ingest: Mint a short-lived, session-scoped ingest
credential on your backend (
issueIngestToken) and pass it toBardiyaIngest.BardiyaIngestrejectsbdy_*API keys and client tokens. - Realtime Viewer: Use a short-lived client token (
bdy_cli_*) or session-scoped credential withBardiyaRealtimeController.
Map widget, route, markers, location, and camera control
BardiyaMap(
style: proxiedStyleUrl,
initialCameraPosition: const CameraPosition(
target: LatLng(30.0444, 31.2357),
zoom: 12,
),
route: BardiyaRoute.fromDirectionsResponse(directionsResponse),
markers: const [
BardiyaMarker(
id: 'vehicle-1',
latitude: 30.05,
longitude: 31.24,
label: 'Rider 1',
),
],
location: const BardiyaLocation(
latitude: 30.048,
longitude: 31.239,
accuracyMeters: 8,
),
onBardiyaMapCreated: (controller) {
controller.fitRoute(route);
},
)
Coordinates are WGS84. GeoJSON output uses [longitude, latitude] order.
Invalid or out-of-range coordinates, empty marker ids, and duplicate marker ids
throw ArgumentError.
Realtime lifecycle & resource disposal
BardiyaRealtimeController integrates with WidgetsBindingObserver so SSE
connections pause automatically when the app enters the background and resume on
foreground, suppress duplicate event.id frames, back off exponentially on
transient errors, stop on 401/402/403/404/terminal-sandbox-429, and
cancel subscriptions and timers on dispose().
final realtime = BardiyaRealtimeController.forSession(
client: client,
sessionId: sessionId,
credential: sessionCredential,
);
await realtime.start();
// In State.dispose():
await realtime.dispose();
No OS location permissions are requested by bardiyamap_flutter. Background GPS
collection is intentionally outside the core SDK: the widget draws the device
location you supply and the package ships no background location collectors.
See the SDK documentation for current
Android and iOS runtime qualification boundaries.
Validation
flutter pub get
flutter analyze
flutter test
maplibre_gl 0.27.1 requires a Java 21 Gradle JVM for Android builds. Physical
devices, production tiles, and background GPS collection are not qualified by
synthetic widget/CI checks.
License
Apache-2.0. See LICENSE and NOTICE in this directory. Applies to the SDK
only; the Bardiya Map service and data are licensed separately.
Libraries
- bardiyamap_flutter
- Official Bardiya Map Flutter integration.