Download this source code for
5 USD


Download this source code for
5 USD


Download this source code for
5 USD


Download this source code for
5 USD

here maps webservice

here_maps_webservice provides here maps web services api wrapper that serve different purposes from search, to geocoding.

usage

add here_maps_webserviceas a dependency in your pubspec.yaml

 dependencies:
  flutter:
    sdk: flutter
  here_maps_webservice: 1.0.2

run flutter pub get in the terminal and import import 'package:here_maps_webservice/here_maps.dart'

availabel apis

generate api key

go to https://developer.here.com/ and create a new account if you don’t have one. create a new project and select freemium plan.
under the rest section of your project, click on create api key.

example for here maps app

nearby places
    import 'package:here_maps_webservice/here_maps.dart';
    import 'package:location/location.dart' as l; 
    import 'package:flutter/services.dart';
    
    var currentlocation;
    var location = new l.location();
    list<dynamic> _nearbyplaces=[]; 

    try {
      currentlocation = await location.getlocation();
      }on platformexception catch (error) {
      if (error.code == 'permission_denied') {
        print("permission dennied");
      }
    }
    
    heremaps(apikey: "your apikey")
          .explorenearbyplaces( lat: currentlocation.latitude, lon: currentlocation.longitude,offset: 10)
          .then((response) {
              setstate(() {
                  _nearbyplaces.addall(response['results']['items']);
              });
          });

popular places
    import 'package:here_maps_webservice/here_maps.dart';
    import 'package:location/location.dart' as l; 
    import 'package:flutter/services.dart';
    
    var currentlocation;
    var location = new l.location();
    list<dynamic> _explorepopularplace = []; 

    try {
      currentlocation = await location.getlocation();
      }on platformexception catch (error) {
      if (error.code == 'permission_denied') {
        print("permission dennied");
      }
    }
    
    heremaps(apikey: "your apikey")
          .explorepopularplaces(
              lat: currentlocation.latitude,
              lon: currentlocation.longitude,
              offset: 10)
          .then((response) {
        setstate(() {
          _explorepopularplace.addall(response['results']['items']);
        });
      });

geocoding autocomplete
     import 'package:here_maps_webservice/here_maps.dart';
     
     list<dynamic> _suggestion = [];
     
     heremaps(apikey: "your apikey")
           .geocodingautocomplete(query: "yourquery")
           .then((response) {
         setstate(() {
           _suggestion.addall(response['suggestions']);
         });
       });
geocoding
    import 'package:here_maps_webservice/here_maps.dart';
    
    map<string, dynamic> latlon = map();
    
    heremaps(apikey: "your apikey")
        .geocode(searchtext: _searchcontroller.text)
        .then((response) {
      setstate(() {
        latlon = response['response']['view'][0]['result'][0]['location']
            ['displayposition'];
      });
    });
reverse geocoding
    import 'package:here_maps_webservice/here_maps.dart';
    import 'package:location/location.dart' as l; 
    import 'package:flutter/services.dart';
    
    var currentlocation;
    var location = new l.location();

    try {
      currentlocation = await location.getlocation();
      }on platformexception catch (error) {
      if (error.code == 'permission_denied') {
        print("permission dennied");
      }
    }
    
    map<string,dynamic> response = heremaps(apikey: "your apikey")
      .reversegeocode(lat: currentlocation.latitude, lon: currentlocation.longitude)

todo

  • add all the parameters in the existing apis
  • add tests
  • make model class for exisitng apis
  • add routing apis

feature requests and issues

please file feature requests and bugs at the issue tracker


Download this source code for
5 USD


Download this source code for
5 USD


Download this source code for
5 USD


Download this source code for
5 USD

Comments are closed.