Platforms and setup
Native platforms: ios, android.
Public actions
BaiduMaps.openBaiduMaps.viewBaiduMaps.searchBaiduMaps.nearbySearchBaiduMaps.lineBaiduMaps.directionsBaiduMaps.directionsWithCoordsBaiduMaps.navigate
BaiduMaps.open
factory BaiduMaps.open({ final bool fallbackToStore = false, final String sourceApplication = _defaultSourceApplication, })
Launch with DeeplinkX.launchApp. Native platforms: ios, android. Action web fallback: available. Store-fallback flag: supported; opt in explicitly.
| Parameter | Type | Required | Default |
|---|---|---|---|
fallbackToStore | bool | No | false |
sourceApplication | String | No | _defaultSourceApplication |
BaiduMaps.view
static BaiduMapsViewAction view({ required final Coordinate coordinate, final String? title, final String? content, final int? zoom, final BaiduMapsCoordType coordType = BaiduMapsCoordType.bd09ll, final bool traffic = false, final String sourceApplication = _defaultSourceApplication, final bool fallbackToStore = false, })
Launch with DeeplinkX.launchAction. Native platforms: ios, android. Action web fallback: available. Store-fallback flag: supported; opt in explicitly.
| Parameter | Type | Required | Default |
|---|---|---|---|
coordinate | Coordinate | Yes | — |
title | String? | No | — |
content | String? | No | — |
zoom | int? | No | — |
coordType | BaiduMapsCoordType | No | BaiduMapsCoordType.bd09ll |
traffic | bool | No | false |
sourceApplication | String | No | _defaultSourceApplication |
fallbackToStore | bool | No | false |
BaiduMaps.search
static BaiduMapsSearchAction search({ required final String query, final String? region, final Coordinate? center, final BaiduMapsBounds? bounds, final int? radius, final int? zoom, final BaiduMapsCoordType coordType = BaiduMapsCoordType.bd09ll, final String sourceApplication = _defaultSourceApplication, final bool fallbackToStore = false, })
Launch with DeeplinkX.launchAction. Native platforms: ios, android. Action web fallback: available. Store-fallback flag: supported; opt in explicitly.
| Parameter | Type | Required | Default |
|---|---|---|---|
query | String | Yes | — |
region | String? | No | — |
center | Coordinate? | No | — |
bounds | BaiduMapsBounds? | No | — |
radius | int? | No | — |
zoom | int? | No | — |
coordType | BaiduMapsCoordType | No | BaiduMapsCoordType.bd09ll |
sourceApplication | String | No | _defaultSourceApplication |
fallbackToStore | bool | No | false |
BaiduMaps.nearbySearch
static BaiduMapsNearbySearchAction nearbySearch({ required final String query, final Coordinate? center, final int? radius, final BaiduMapsCoordType coordType = BaiduMapsCoordType.bd09ll, final String sourceApplication = _defaultSourceApplication, final bool fallbackToStore = false, })
Launch with DeeplinkX.launchAction. Native platforms: ios, android. Action web fallback: available. Store-fallback flag: supported; opt in explicitly.
| Parameter | Type | Required | Default |
|---|---|---|---|
query | String | Yes | — |
center | Coordinate? | No | — |
radius | int? | No | — |
coordType | BaiduMapsCoordType | No | BaiduMapsCoordType.bd09ll |
sourceApplication | String | No | _defaultSourceApplication |
fallbackToStore | bool | No | false |
BaiduMaps.line
static BaiduMapsLineAction line({ required final String name, final String? region, final int? zoom, final String sourceApplication = _defaultSourceApplication, final bool fallbackToStore = false, })
Launch with DeeplinkX.launchAction. Native platforms: ios, android. Action web fallback: available. Store-fallback flag: supported; opt in explicitly.
| Parameter | Type | Required | Default |
|---|---|---|---|
name | String | Yes | — |
region | String? | No | — |
zoom | int? | No | — |
sourceApplication | String | No | _defaultSourceApplication |
fallbackToStore | bool | No | false |
BaiduMaps.directions
static BaiduMapsDirectionsAction directions({ required final String destination, final String? origin, final String? region, final BaiduMapsTravelMode mode = BaiduMapsTravelMode.driving, final BaiduMapsCoordType coordType = BaiduMapsCoordType.bd09ll, final String sourceApplication = _defaultSourceApplication, final bool fallbackToStore = false, })
Launch with DeeplinkX.launchAction. Native platforms: ios, android. Action web fallback: available. Store-fallback flag: supported; opt in explicitly.
| Parameter | Type | Required | Default |
|---|---|---|---|
destination | String | Yes | — |
origin | String? | No | — |
region | String? | No | — |
mode | BaiduMapsTravelMode | No | BaiduMapsTravelMode.driving |
coordType | BaiduMapsCoordType | No | BaiduMapsCoordType.bd09ll |
sourceApplication | String | No | _defaultSourceApplication |
fallbackToStore | bool | No | false |
BaiduMaps.directionsWithCoords
static BaiduMapsDirectionsWithCoordsAction directionsWithCoords({ required final Coordinate destination, final Coordinate? origin, final String? destinationTitle, final String? originTitle, final String? region, final BaiduMapsTravelMode mode = BaiduMapsTravelMode.driving, final BaiduMapsCoordType coordType = BaiduMapsCoordType.bd09ll, final String sourceApplication = _defaultSourceApplication, final bool fallbackToStore = false, })
Launch with DeeplinkX.launchAction. Native platforms: ios, android. Action web fallback: available. Store-fallback flag: supported; opt in explicitly.
| Parameter | Type | Required | Default |
|---|---|---|---|
destination | Coordinate | Yes | — |
origin | Coordinate? | No | — |
destinationTitle | String? | No | — |
originTitle | String? | No | — |
region | String? | No | — |
mode | BaiduMapsTravelMode | No | BaiduMapsTravelMode.driving |
coordType | BaiduMapsCoordType | No | BaiduMapsCoordType.bd09ll |
sourceApplication | String | No | _defaultSourceApplication |
fallbackToStore | bool | No | false |
BaiduMaps.navigate
static BaiduMapsNavigateAction navigate({ required final Coordinate destination, final String? destinationTitle, final BaiduMapsNavigationMode mode = BaiduMapsNavigationMode.driving, final BaiduMapsCoordType coordType = BaiduMapsCoordType.bd09ll, final String sourceApplication = _defaultSourceApplication, final bool fallbackToStore = false, })
Launch with DeeplinkX.launchAction. Native platforms: ios, android. Action web fallback: available. Store-fallback flag: supported; opt in explicitly.
| Parameter | Type | Required | Default |
|---|---|---|---|
destination | Coordinate | Yes | — |
destinationTitle | String? | No | — |
mode | BaiduMapsNavigationMode | No | BaiduMapsNavigationMode.driving |
coordType | BaiduMapsCoordType | No | BaiduMapsCoordType.bd09ll |
sourceApplication | String | No | _defaultSourceApplication |
fallbackToStore | bool | No | false |
Provider setup and examples
DeeplinkX supports Baidu Maps URI actions on Android and iOS. The integration uses the baidumap scheme and Android package-targeted intents so launch attempts can prefer the native app before falling back.
References
- Baidu Maps Android URI API: https://lbs.baidu.com/faq/api?title=webapi%2Furi%2Fandriod
- Baidu Maps iOS URI API: https://lbs.baidu.com/docs/webapi?title=mapadjustment%2Furi%2Fios
Usage
Launch Baidu Maps
final deeplinkX = DeeplinkX();
await deeplinkX.launchApp(BaiduMaps.open());
View A Marker
await deeplinkX.launchAction(
BaiduMaps.view(
coordinate: const Coordinate(latitude: 39.915, longitude: 116.404),
title: 'Tiananmen',
content: 'Beijing landmark',
zoom: 16,
coordType: BaiduMapsCoordType.wgs84,
sourceApplication: 'my_flutter_app',
),
);
Search
await deeplinkX.launchAction(
BaiduMaps.search(
query: 'coffee',
region: 'Beijing',
center: const Coordinate(latitude: 39.915, longitude: 116.404),
radius: 1000,
),
);
Nearby Search
await deeplinkX.launchAction(
BaiduMaps.nearbySearch(
query: 'hotel',
center: const Coordinate(latitude: 31.2304, longitude: 121.4737),
radius: 2500,
),
);
Transit Line
await deeplinkX.launchAction(
BaiduMaps.line(
name: 'Line 1',
region: 'Beijing',
),
);
Directions By Text
await deeplinkX.launchAction(
BaiduMaps.directions(
origin: 'Beijing Railway Station',
destination: 'Tiananmen',
region: 'Beijing',
mode: BaiduMapsTravelMode.transit,
),
);
If origin is omitted, DeeplinkX uses Baidu Maps' current-location token.
Directions By Coordinates
await deeplinkX.launchAction(
BaiduMaps.directionsWithCoords(
origin: const Coordinate(latitude: 39.9042, longitude: 116.4074),
originTitle: 'Start',
destination: const Coordinate(latitude: 39.915, longitude: 116.404),
destinationTitle: 'Tiananmen',
region: 'Beijing',
mode: BaiduMapsTravelMode.walking,
coordType: BaiduMapsCoordType.wgs84,
),
);
Native Navigation
await deeplinkX.launchAction(
BaiduMaps.navigate(
destination: const Coordinate(latitude: 39.915, longitude: 116.404),
destinationTitle: 'Tiananmen',
mode: BaiduMapsNavigationMode.walking,
),
);
Shared Map Interfaces
These actions implement shared map-action abstractions:
| Interface | Baidu Maps action |
|---|---|
MapViewAction | BaiduMaps.view |
MapSearchAction | BaiduMaps.search |
MapDirectionsAction | BaiduMaps.directions |
MapDirectionsWithCoordsAction | BaiduMaps.directionsWithCoords |
The nearbySearch, line, and navigate actions are Baidu-specific extras.
Platform Configuration
iOS
Add the Baidu Maps scheme to LSApplicationQueriesSchemes in ios/Runner/Info.plist:
<key>LSApplicationQueriesSchemes</key>
<array>
<string>baidumap</string>
</array>
Android
Add Baidu Maps to package visibility in android/app/src/main/AndroidManifest.xml:
<queries>
<package android:name="com.baidu.BaiduMap" />
<intent>
<action android:name="android.intent.action.VIEW" />
<data android:scheme="baidumap" />
</intent>
</queries>
URI Formats
| Action | URI format |
|---|---|
| View marker | baidumap://map/marker |
| Search | baidumap://map/place/search |
| Nearby search | Android place/nearby; iOS nearbysearch |
| Transit line | baidumap://map/line |
| Directions | baidumap://map/direction |
| Driving navigation | baidumap://map/navi |
| Walking navigation | baidumap://map/walknavi |
| Riding navigation | Android bikenavi, iOS ridenavi |
Every action accepts an optional sourceApplication, defaulting to
deeplink_x; the generated src is prefixed with andr. or ios. for the
target platform. Omitted marker text uses Pin and Description. Transit line
lookups require a nonblank region, and iOS driving navigation accepts an
optional destinationTitle for its required query label.
DeeplinkX uses familiar marker defaults and Baidu's
name:...|latlng:... route-point format while enforcing provider-required
transit regions and distinct Android and iOS nearby-search paths and parameter
names.
Fallbacks
| Condition | Behavior |
|---|---|
| Baidu Maps installed | Opens Baidu Maps using URI/intents |
| Baidu Maps missing, store enabled | Opens Google Play or the iOS App Store |
| Baidu Maps missing, store off | Falls back to https://map.baidu.com |