map_launcher

This project is based on map_launcher.

1. Installation and Usage

1.1 Installation

Go to the project directory and add the following dependencies in pubspec.yaml

pubspec.yaml

...

dependencies:
  map_launcher_ohos:
    git:
      url: https://gitcode.com/openharmony-sig/fluttertpc_map_launcher.git
      path: ohos
...

Execute Command

flutter pub get

1.2 Usage

For use cases ohos/example

2. Constraints

2.1 Compatibility

This document is verified based on the following versions:

  1. Flutter: 3.7.12-ohos-1.0.6; SDK: 5.0.0(12); IDE: DevEco Studio: 5.0.13.200; ROM: 5.1.0.120 SP3;
  2. Flutter: 3.22.1-ohos-1.0.1; SDK: 5.0.0(12); IDE: DevEco Studio: 5.0.13.200; ROM: 5.1.0.120 SP3;

2.2 Configuring querySchemes

Add querySchemes to the module.json5 file in the entry directory.

Open entry/src/main/module.json5 and add the following information:


...
 "querySchemes": [
      "alipays",
      "amapuri",
      "zhihu",
      "baidumap",
      'maps'
    ]

3. API

If the value of **ohos Support** is **yes**, it means that the ohos platform supports this property; **no** means the opposite; **partially** means some capabilities of this property are supported. The usage method is the same on different platforms and the effect is the same as that of iOS or Android.

Name Description Type Input Output ohos Support
installedMaps Gets list of installed map applications on the device function / Future<List> yes
showMarker Displays marker at specified coordinates in target map application function mapType: MapType, coords: Coords, title: String, description: String?, zoom: int?, extraParams: Map<String, String>? Future yes
showDirections Displays navigation route from origin to destination function mapType: MapType, destination: Coords, destinationTitle: String?, origin: Coords?, originTitle: String?, waypoints: List?, directionsMode: DirectionsMode?, extraParams: Map<String, String>? Future yes
isMapAvailable Checks if specified map application is available function mapType: MapType Future<bool?> yes

4. Properties

If the value of **ohos Support** is **yes**, it means that the ohos platform supports this property; **no** means the opposite; **partially** means some capabilities of this property are supported. The usage method is the same on different platforms and the effect is the same as that of iOS or Android.

DirectionsMode

Name Description Type Input Output ohos Support
driving Driving mode enum / / yes
walking Walking mode enum / / yes
transit Public transportation mode enum / / yes
bicycling Cycling mode enum / / yes

Coords

Name Description Type Input Output ohos Support
latitude Latitude coordinate value double / / yes
longitude Longitude coordinate value double / / yes

Waypoint

Name Description Type Input Output ohos Support
coords Coordinate object with lat/lon Coords / / yes
title Marker title String? / / yes

AvailableMap

Name Description Type Input Output ohos Support
mapName Map application display name String / / yes
mapType Map type enum MapType / / yes
icon Icon path (SVG format) String / / yes

showMarker

Name Description Type Input Output ohos Support
coords Coordinates for marker placement Coords / / yes
title Marker title String / / yes
description Marker description text String? / / yes
zoom Map zoom level int? / / yes
extraParams Additional configuration parameters Map<String, String>? / / yes

showDirections

Name Description Type Input Output ohos Support
destination Destination coordinates Coords / / yes
destinationTitle Destination location name String? / / yes
origin Origin coordinates Coords? / / yes
originTitle Origin location name String? / / yes
waypoints List of intermediate points List? / / yes
directionsMode Navigation mode (default: driving) DirectionsMode? / / yes
extraParams Additional configuration parameters Map<String, String>? / / yes

5. Known Issues

6. Others

7. License

This project is licensed under The MIT License.