huawei_map 4.0.4+300

Flutter Android

HUAWEI Map Kit plugin for Flutter. Huawei Map Kit, provides standard maps as well as UI elements such as markers, shapes, and layers for you to customize maps that better meet service scenarios.

logo Huawei Map Kit Flutter Plugin #

HUAWEI MAP

Table of Contents #

Introduction #

This plugin enables communication between Huawei Map SDK and Flutter platform. Huawei Map Kit, provides standard maps as well as UI elements such as markers, shapes, and layers for you to customize maps that better meet service scenarios. Enables users to interact with a map in your app through gestures and buttons in different scenarios.

Huawei Map Kit provides the following core capabilities:

  • Huawei Map: Core map component with tons of features.
  • My Location: Your location on the map.
  • Markers: Adding markers on the map with tons of modifications with their InfoWindow component.
  • Polylines: Adding polylines on the map with tons of modifications.
  • Polygons: Adding polygons on the map with tons of modifications.
  • Circles: Adding circles on the map with tons of modifications.

Installation Guide #

agconnect

  • Copy the agconnect-service.json file to the android/app directory.
  • Open the build.gradle file in the android directory of your project.
    • Go to buildscript then configure the Maven repository address and agconnect plugin for the HMS SDK.

        buildscript {
            repositories {
                google()
                jcenter()
                maven { url 'https://developer.huawei.com/repo/' }
            }
      
            dependencies {
                /* 
                 * <Other dependencies>
                 */
                classpath 'com.huawei.agconnect:agcp:1.3.1.300'
            }
        }
      
    • Go to allprojects then configure the Maven repository address for the HMS SDK.

        allprojects {
            repositories {
                google()
                jcenter()
                maven { url 'https://developer.huawei.com/repo/' }
            }
        }
      
    • Open the build.gradle file in the android/app directory.

- Add `apply plugin: 'com.huawei.agconnect'` line after the `apply plugin: 'com.android.application'` line.

    ```gradle
    apply plugin: 'com.android.application'
    apply plugin: 'com.huawei.agconnect'
    apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
    ```

- Set your package name in **defaultConfig** > **applicationId**. Package name must match with the **package_name** entry in **agconnect-services.json** file.
    ```gradle
    defaultConfig {
            applicationId "<package_name>"
            /*
             * <Other configurations>
             */
        }
    ```

- Copy the signature file that generated in [Generating a Signing Certificate](https://developer.huawei.com/consumer/en/codelab/HMSPreparation/index.html#3) to **android/app** directory.

- Configure the signature in **android** according to the signature file information.

    ```gradle
    android {
        /*
         * <Other configurations>
         */

        signingConfigs {
            config {
                storeFile file('<keystore_file>.jks')
                storePassword '<keystore_password>'
                keyAlias '<key_alias>'
                keyPassword '<key_password>'
            }
        }

        buildTypes {
            debug {
                signingConfig signingConfigs.config
            }
            release {
                signingConfig signingConfigs.config
            }
        }
    }
    ```
  • Check whether the agconnect-services.json and signature file are successfully added to your project.

    signature

  • On your Flutter project directory find and open your pubspec.yaml file and add library to dependencies.

      dependencies:
          huawei_map:
              # Replace {library path} with actual library path of Huawei Map Kit Flutter Plugin. (ex: ../)
              path: {library path}
    
  • Run

      flutter pub get
    

    or

    From Android Studio/IntelliJ: Click Packages get in the action ribbon at the top of pubspec.yaml. From VS Code: Click Get Packages located in right side of the action ribbon at the top of pubspec.yaml.

  • Add a corresponding import statement in the Dart code and start the app.

      import 'package:huawei_map/map.dart';
    

API Reference #

ClassDescription
BitmapDescriptorDefines a bitmap image. A bitmap image can be used for a marker icon.
CameraPositionA class that encapsulates all camera attributes.
CameraTargetBoundsA class that encapsulates bound attribute.
CameraUpdateDefines a camera move.
CapDefines a cap that is applied at the start or end vertex of a polyline.
CircleDefines a circle on a map.
CircleIdRepresents the immutable circleId
HuaweiMapA main class of the HUAWEI Map Kit SDK.
HuaweiMapOptionsThis class defines attributes for a HuaweiMap object.
InfoWindowDefines an InfoWindow.
JointTypeDefines the joint type for a polyline or the outline of a polygon.
LatLngRepresents the longitude and latitude, in degrees.
LatLngBoundsRepresents a longitude/latitude aligned rectangle.
MarkerDefines an icon placed at a specified position on a map.
MarkerIdRepresents the immutable markerId
MinMaxZoomPreferenceA class that encapsulates min and max zoom attributes.
PatternItemAn immutable class that describes the stroke pattern of a polyline or the outline of a polygon or circle.
PolygonDefines a polygon on a map.
PolygonIdRepresents the immutable polygonId
PolylineDefines a polyline on a map.
PolylineIdRepresents the immutable polylineId
ScreenCoordinateA class that encapsulates x and y attributes.

You can read more and get detailed information about the interfaces described above from developer.huawei.com

Configuration Description #

No.

Licensing and Terms #

Huawei Map Kit Flutter Plugin uses the Apache 2.0 license.

9
likes
70
pub points
58%
popularity

Publisher

developer.huawei.com

HUAWEI Map Kit plugin for Flutter. Huawei Map Kit, provides standard maps as well as UI elements such as markers, shapes, and layers for you to customize maps that better meet service scenarios.

Homepage
Repository (GitHub)
View/report issues

Documentation

API reference

License

Apache 2.0 (LICENSE)

Dependencies

flutter, flutter_plugin_android_lifecycle, meta, stream_transform

More

Packages that depend on huawei_map