Map SDK

The application supports 3 different map providers out of the box, In this section we will cover how to activate each one of them and also how to activate one as default.

OpenStreet Map

A free option in case you want to have your solution's running costs minimized. This SDK does not require any additional configuration to work and the source code downloaded is already set to use this option by default.

Google Maps

Probably the most famous Maps SDK offering great location coverage and decent aesthetics. In order to configure Google Maps you can refer to their official documentation:

MapBox

In order to configure the MapBox you will need a secret key which you can retrieve by registering on the MapBox website. Locate the .env.prod file in the <Project folder>. Input your API key into the MAPBOX_TOKEN variable.

constants.dart
DEMO_MODE=true
FIREBASE_MESSAGING_VAPID_KEY=
MAPBOX_TOKEN=
MAPLIBRE_API_KEY=
MAPLIBRE_STYLE_URL=https://api.maptiler.com/maps/streets-v2/style.json
MAPLIBRE_STYLE_DARK_URL=https://api.maptiler.com/maps/streets-v2-dark/style.json

Activate the default SDK

The logic for selecting the provider is located in libs/flutter_common/lib/config/constants.dart. The map provider switch allows for changing the provider according to the target platform.:

static PlatformMapProviderSettings get mapProviderPlatformSettings => PlatformMapProviderSettings(
    defaultProvider: MapProviderEnum.openStreetMaps,
    desktopProvider: MapProviderEnum.openStreetMaps,
    webProvider: MapProviderEnum.openStreetMaps,
  );

Last updated