Skip to content

A flutter plugin for VietMap APIs. This plugin is a wrapper around VietMap APIs for Android and iOS.

License

Notifications You must be signed in to change notification settings

vietmap-company/vietmap_flutter_plugin

Repository files navigation

A Dart package for using the VietMap APIs in Dart.

Vietmap API Flutter plugin

Contact vietmap.vn to register a valid key.

Getting started

Add library to pubspec.yaml file

  vietmap_flutter_plugin: latest_version

Check the latest version at https://pub.dev/packages/vietmap_flutter_plugin

or run this command in the terminal to add the library to the project:

  flutter pub add vietmap_flutter_plugin

Usage

Init plugin

  • You must call Vietmap.getInstance(apiKey) before using any other methods.
    Vietmap.getInstance('YOUR_API_KEY_HERE');
  • We provide below methods to use Vietmap APIs:
    Vietmap.autocomplete(VietMapAutoCompleteParams(textSearch: 'Hà Nội'));
    
    Vietmap.geoCode(VietMapAutoCompleteParams(textSearch: 'Hà Nội'));
    
    Vietmap.reverse(LatLng(21.027763, 105.834160));
    
    Vietmap.place('Place ID');
    
    Vietmap.routing(VietMapRoutingParams(points: [
      LatLng(21.027763, 105.834160),
      LatLng(21.027763, 105.834160)
    ]));
    
    /// This function is used to get the style url of Vietmap,
    /// which provide the style of the map for VietmapGL plugin.
    Vietmap.getVietmapStyleUrl();
    Vietmap.matrix(VietmapMatrixParams(
      points: [
        const LatLng(10.768897, 106.678505),
        const LatLng(10.765496, 106.67626),
        const LatLng(10.7627936, 106.6750729),
        const LatLng(10.7616745, 106.6792425),
        const LatLng(10.765605, 106.685383),
      ],
      sourcePoints: [0, 1],
      isShowTablePreview: true,
      destinationPoints: [
        2, 3, 4,
    ]));
                

Additional information

This package is a part of Vietmap API project.

Troubleshooting

Our plugin depend on dio and dartz package with latest version. If our plugin conflict with your current project, please try to use the latest version of these packages or follow the instruction below:

dependencies:
    dio: your_project_version
    dartz: your_project_version

dependencies_override:
    dio: our_plugin_version
    dartz: our_plugin_version

We use dartz package to response the api result. Please check the dartz package to know how to handle the result.

var autocompleteData = await Vietmap.autocomplete(VietMapAutoCompleteParams(textSearch: 'Hà Nội'));
autocompleteData.fold(
      (Failure left) {
        // Handle error here
      },
      (List<VietmapAutocompleteModel> right) {
        // Handle success here
      },
    );

Note: Replace apikey which is provided by VietMap to all YOUR_API_KEY_HERE tag to the application work normally

Email us: [email protected]

Vietmap API and price here

Contact for support

Vietmap API document here

Have a bug to report? Open an issue. If possible, include a full log and information which shows the issue.

Have a feature request? Open an issue. Tell us what the feature should do and why you want the feature.

About

A flutter plugin for VietMap APIs. This plugin is a wrapper around VietMap APIs for Android and iOS.

Resources

License

Stars

Watchers

Forks

Packages

No packages published