Platforms and setup
Native platforms: ios, android.
Public actions
GoogleMaps.open
factory GoogleMaps.open({final bool fallbackToStore = false})
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 |
GoogleMaps.view
static GoogleMapsViewAction view({ required final Coordinate coordinate, final double? zoom, 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 | — |
zoom | double? | No | — |
fallbackToStore | bool | No | false |
GoogleMaps.search
static GoogleMapsSearchAction search({ required final String query, 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 | — |
fallbackToStore | bool | No | false |
GoogleMaps.directions
static GoogleMapsDirectionsAction directions({ required final String destination, final String? origin, final GoogleMapsTravelMode? mode, 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 | — |
mode | GoogleMapsTravelMode? | No | — |
fallbackToStore | bool | No | false |
GoogleMaps.directionsWithCoords
static GoogleMapsDirectionsWithCoordsAction directionsWithCoords({ required final Coordinate destination, final Coordinate? origin, final GoogleMapsTravelMode? mode, 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 | — |
mode | GoogleMapsTravelMode? | No | — |
fallbackToStore | bool | No | false |
Provider setup and examples
DeeplinkX provides support for Google Maps deep linking actions on iOS and Android.
References
Available Actions
Launch Google Maps App
final deeplinkX = DeeplinkX();
await deeplinkX.launchApp(GoogleMaps.open());
View Map Action
await deeplinkX.launchAction(
GoogleMaps.view(
coordinate: const Coordinate(latitude: 37.4220, longitude: -122.0841),
zoom: 14,
),
);
Search Location Action
await deeplinkX.launchAction(
GoogleMaps.search(query: 'Central Park, New York'),
);
Directions Action
await deeplinkX.launchAction(
GoogleMaps.directions(
origin: 'Times Square, New York',
destination: 'Statue of Liberty',
mode: GoogleMapsTravelMode.transit,
),
);
Directions with Coordinates Action
await deeplinkX.launchAction(
GoogleMaps.directionsWithCoords(
origin: const Coordinate(latitude: 40.7580, longitude: -73.9855),
destination: const Coordinate(latitude: 40.6892, longitude: -74.0445),
mode: GoogleMapsTravelMode.walking,
),
);
Platform Configuration
iOS
Add the following to your ios/Runner/Info.plist inside the LSApplicationQueriesSchemes array:
<string>comgooglemaps</string>
Android
Add the following to your android/app/src/main/AndroidManifest.xml inside the <queries> tag:
<package android:name="com.google.android.apps.maps" />
URL Schemes
Native App Deep Links
- View map:
comgooglemaps://?center={lat},{lng}&zoom={zoom} - Search:
comgooglemaps://?q={query} - Directions:
comgooglemaps://?saddr={origin}&daddr={destination}&directionsmode={mode} - Directions with coordinates:
comgooglemaps://?saddr={origin_lat},{origin_lng}&daddr={dest_lat},{dest_lng}&directionsmode={mode}
Android Intent URIs
- View map:
geo:{lat},{lng}?z={zoom} - Search:
geo:0,0?q={query} - Directions:
https://www.google.com/maps/dir/?api=1&destination={destination}&origin={origin}&travelmode={mode} - Directions with coordinates:
https://www.google.com/maps/dir/?api=1&destination={dest_lat},{dest_lng}&origin={origin_lat},{origin_lng}&travelmode={mode}
Web Fallback URLs
- View map:
https://www.google.com/maps/@?api=1&map_action=map¢er={lat},{lng}&zoom={zoom} - Search:
https://www.google.com/maps/search/?api=1&query={query} - Directions:
https://www.google.com/maps/dir/?api=1&destination={destination}&origin={origin}&travelmode={mode} - Directions with coordinates:
https://www.google.com/maps/dir/?api=1&destination={dest_lat},{dest_lng}&origin={origin_lat},{origin_lng}&travelmode={mode} - Directions from current location:
https://www.google.com/maps/dir/?api=1&destination=40.6892,-74.0445
Google requires api=1 on Maps URLs. Without it, the documented action parameters can be ignored. Coordinate destinations use latitude,longitude order; when origin is omitted, Google Maps starts from the user's current location.
Supported Fallback Stores
When the Google Maps app is not installed, DeeplinkX can redirect users to download Google Maps from:
- iOS App Store
- Google Play Store
Enable fallback with the fallbackToStore parameter when launching actions or apps.
Fallback Behavior
- Attempt to launch the Google Maps app if installed.
- If not installed and
fallbackToStoreistrue, redirect to the appropriate app store. - If the store cannot be opened, fall back to opening the Google Maps website.
- Disable all fallbacks by setting
disableFallback: true.
Fallback Support for Actions
| Action | Store Fallback | Web Fallback |
|---|---|---|
| Open app | ✔️ | ✔️ |
| View map | ✔️ | ✔️ |
| Search | ✔️ | ✔️ |
| Directions | ✔️ | ✔️ |
| Directions with coordinates | ✔️ | ✔️ |