Examples
Most code snippets in this guide can also be found as part of small, focused example apps. You have two ways to access them:
- Find the latest example apps for your product bundled within the downloaded package you can find on the HERE platform.
- Find the latest example apps for the HERE Explore on GitHub.
- Find the latest example apps for the HERE Navigate on GitHub.
NoteMost example apps are written in a consistent way where a "XYExample.dart" file contains the relevant code. UI elements are mostly left out or kept minimal to not shadow the important parts of the code. Note that the HERE SDK itself does offer most APIs headless without UI.
For this guide and the accompanying example apps, we preferably avoid the use of lambda notations to show the full type of information and other details, such as callback or listener name. Since Android Studio supports one-click conversion between anonymous classes and lambdas, adapting the examples to suit your personal preference should be simple.
Despite the popular phrase that "everything is a widget", the example code is kept free of most Flutter dependencies - instead it's mostly pure Dart code that shows how the HERE SDK can be used.
Available example apps
Use the map camera
The "Camera" app shows how to change the target and the target anchor point and how to move to another location using custom map animations.
Create custom camera animations
The "CameraKeyframeTracks" app shows how to do custom camera animations with keyframe tracks.
Show various map schemes & map layers
The "MapFeatures" app shows how to enable different map view features such as different map layers and map schemes. Only available for the Navigate.
Visualize real-time traffic on a map view
The "Traffic" app shows how to search for real-time traffic and how to visualize it on the map.
Interact with the map view using gestures
The "Gestures" app shows how to handle gestures like tap, double-tap, pinch & rotate and many more.
Add map items
The "MapItems" app shows how to add circles, polygons and polylines, native views, 2D and 3D map markers to locate POIs (and more) on the map.
Pick embedded POIs
The "CartoPOIPicking" app shows how to pick embedded map markers with extended place details. Embedded map markers are already visible on every map, by default.
Style your own map schemes
The "CustomMapStyles" app shows how to load custom map schemes made with the HERE Style Editor.
Add custom tile sources
The "CustomTileSource" app demonstrates how to load custom point layers, implement clustering functionality using a custom point tile source, and integrate custom raster layers.
Find places, use geocoding and reverse geocoding online
The "Search" app shows how to search POIs and add them to the map. Also shows geocoding and reverse geocoding.
Find places, use geocoding and reverse geocoding online & offline
The "SearchHybrid" app shows how to search for places including auto suggestions, for the address that belongs to certain geographic coordinates (reverse geocoding) and for the geographic coordinates that belong to an address (geocoding). It also shows how to search offline, when no internet connection is available. Only available for the Navigate.
Calculate and visualize routes online
The "Routing" app shows how to calculate routes and add them to the map.
Calculate and visualize routes online & offline
The "RoutingHybrid" app shows how to calculate routes online and offline. Only available for the Navigate.
Calculate EV routes
The "EVRouting" app shows how to calculate routes for electric vehicles, area of reach with isoline routing, and how to search along a route.
Optimize routes with avoidance options
The "RoutingWithAvoidanceOptions" app shows how to calculate routes with AvoidanceOptions and how to use the SegmentDataLoader to retrieve data from the map. It also allows to pick segments from the map to avoid certain areas or roads. Only available for the Navigate.
Calculate routes for public transport
The "PublicTransit" app shows how to calculate routes for buses, trains, and subways.
Integrate HERE Positioning
The "Positioning" app shows how to integrate HERE Positioning to find out where you are. Only available for the Navigate.
Track and record outdoor trips
The "HikingDiary" app shows how to record GPX traces with HERE Positioning. Only available for the Navigate.
Get started with navigation
The "NavigationQuickStart" app shows how to get started with turn-by-turn navigation. Only available for the Navigate.
Use turn-by-turn navigation with tracking features
The "Navigation" app gives an overview of how to implement turn-by-turn navigation along with tracking features and voice assistance. Only available for the Navigate.
Customize turn-by-turn navigation
The "NavigationCustom" app shows how the guidance view can be customized. Only available for the Navigate.
Display navigation event during turn-by-turn navigation
The "NavigationWarners" app shows how to implement various navigation events such as speed limit and lane assistance during turn-by-turn navigation. Only available for the Navigate.
Use spatial audio navigation
The "SpatialAudioNavigation" app shows how to make use of spatial audio notifications for TTS voices during guidance. Only available for the Navigate.
Handle rerouting during navigation
The "Rerouting" app shows how the HERE SDK can be used to handle rerouting during guidance after a driver left the route. Only available for the Navigate.
Use navigation for trucks
The "TruckGuidance" app shows how the HERE SDK can be used to calculate routes specific for trucks and many more truck-related features. Only available for the Navigate.
Start navigation headlessly without a map view
The "NavigationHeadless" app show the HERE SDK can be set up to navigate without following a route in the most simplest way - and without showing a map view. Only available for the Navigate.
Use offline maps
The "OfflineMaps" app shows how the HERE SDK can work fully offline and how offline map data can be downloaded for continents and countries. Only available for the Navigate.
Integrate Indoor maps
The "IndoorMap" app shows how to integrate private venues. Only available for the Navigate.
Write unit tests for the HERE SDK
The "UnitTesting" app helps you mock SDK classes for solid unit testing.
Unless otherwise noted, the same app can be executed with Explore or Navigate credentials.
How to build an example app
Choose an example of your choice, then inside the example app's folder, open main.dart and set your credentials (key / secret).
Now add the HERE SDK plugin folder:
- Unzip the downloaded HERE SDK for Flutter package. This folder contains various files including this documentation.
- Inside you will find a TAR file that contains the HERE SDK for Flutter plugin.
- Now unzip the TAR file and rename the folder to 'here_sdk' and place it to the
pluginsfolder inside the example app's directory.
Finally, make sure that a device is attached or that an emulator (Android) or simulator (iOS) is running. Execute flutter run from the directory of the example on your terminal - or run the app from within your IDE.
To learn how the HERE SDK integrates into apps, see Integrate the HERE SDK.
List of demo apps
- If you are interested to see a demo of the features the HERE SDK has to offer - or if you simply want to see all features in action, check the HERE WeGo application. This app uses the same technology stack that empowers the HERE SDK.
- Alternatively, you can build and run the reference application (available only for Flutter) which you can find as an open source project on GitHub. This app shows most features of Navigate including the features from Explore in an release-ready app with easy-to-understand UX flows and reusable UI assets.
About the reference application
The reference application for the HERE SDK for Flutter (Navigate) shows how a complex and release-ready project targeting iOS and Android devices may look like. You can use it as a source of inspiration for your own HERE SDK based projects - in parts or as a whole. Many parts of the app overlap with Explore - however, guidance requires the HERE SDK (Navigate).
The reference application can be used as a base project to start your own app development.
On top, the reference application offers a lot of ready-made assets that can be used for your own apps based on the terms shown on the GitHub page.
Below you can find the available selection of maneuver icons that can be shown to indicate a maneuver action - for example, during turn-by-turn guidance.
The reference application also contains a variety of other icons, such as map markers, to get you started quickly with your own application.
Below you can find an overview of selected features along with the related code that can be used in your own projects.
- Main menu / landing page: The landing page displays a map with an options tab on the top left and a search button on the bottom right: Source for Main Menu and Landing Page.
- Search: The search result option takes you to the exact requested location with a cyan-colored placeholder: SearchResult Source Code.
- Search suggestions: Search suggestions are loaded as soon as typing starts: Search Suggestion and Popup Source Code.
- Place detail info bubble: The place detail popup shows a detailed view of the selected place: Source Code for Place Detail Popup.
- Routing: The routing section in providing a visual overview of the fastest route available to reach your location: Source Code for Routing.
- Route preference for different vehicles: Simulated location events (along the route) are provided for different vehicles as per their route preference: Source Code for Route Preference for Different Vehicles.
- Navigate along a route: Navigating becomes easier with the clean and crisp navigation provided to take you the requested location efficiently: Source Code for Navigating along a route.
- Positioning and user consent: Source Code.
- Offline maps: Source Code.
More reusable icons can be found in the official HERE Icon Library.
How to build the reference application
Build instructions are given on the GitHub page hosting the reference application.
Note that only major versions of the HERE SDK for Flutter are supported.
Updated 4 days ago