Create a New Project
You begin by creating an initial application. Throughout this tutorial, you will modify and extend that starter application to create a simple application which covers the basic features of this guide.
If you need help to create a new project use this official Flutter guide
Set Up Your Environment
This guide explains how to start using a MapsIndoors map in your Flutter application using the MapsIndoors Flutter SDK.
You will need to download and install the flutter toolchain.
We recommend using Android Studio and Xcode for using this tutorial. Read how to set Android Studio up here: Installing Android Studio
If you do not have any devices, you can set up an emulator through Android Studio, or in Xcode.
If you already have an Android device, make sure to enable developer mode and USB debugging
To benefit from the guides, you will need basic knowledge about:
Flutter Development
Mobile Development
Set Up Your Project
To get your project started follow these steps:
Create a new project by writing the following command in your terminal
flutter create --platforms ios,android getting_started_mapsindoors_flutter
This will create a new project targeting Android and iOS platforms.
Go to
lib/main.dartand delete its contents, we will fill it up again during this guide.
If you want to see an example of how this guide will look when completed, you can find it on Github here.
Set Up MapsIndoors
Google Maps
To get started with your project add the latest MapsIndoors version to your pubspec.yaml, it can be found here.
First you need to extend the allowed gradle repositories to allow the SDK to resolve correctly:
Navigate to the app's project level
build.gradle.add
maven { url 'https://maven.mapsindoors.com/' }toallprojects/repositoriesaftermavenCentral()
To get the underlying Google Map to work, you need to perform the following steps:
Navigate to
android/app/src/main/res/value.Create a file in this folder called
google_maps_api_key.xml.Copy and paste the below code snippet and replace
YOUR_KEY_HEREwith your Google Maps API key.
To ensure that the app is able to build properly after obfuscation, we need to add some proguard rules:
Navigate to
android/app/proguard-rules.pro, create it if neccesaryCopy and paste the below code snippet
To get the underlying Google Map to function, you need to perform the following steps:
Providing API key
Swift
Navigate to
iOS/Runner/AppDelegate.swift.Import GoogleMaps on the class
Add this code as the first line inside the application function:
GMSServices.provideAPIKey("YOUR GOOGLE MAPS API KEY HERE")
Objective-C
Navigate to
iOS/Runner/AppDelegate.h.Import
#import "GoogleMaps/GoogleMaps.h"on the class.Add this code as the first line inside the application function:
[GMSServices provideAPIKey:@"YOUR GOOGLE MAPS API KEY HERE"];
Mapbox
To get started with your project add the latest MapsIndoors version to your pubspec.yaml, it can be found here.
First you need to extend the allowed gradle repositories to allow the SDK to resolve correctly:
Navigate to the app's project level
build.gradle.Add
maven { url 'https://maven.mapsindoors.com/' }toallprojects/repositoriesaftermavenCentral()Add mapbox to repositories like in the example below:
Add your mapbox download token to gradle.properties
To get the underlying Mapbox Map to work, you need to perform the following steps:
Navigate to
android/app/src/main/res/value.Create a file in this folder called
mapbox_api_key.xml.Copy and paste the below code snippet and replace
YOUR_KEY_HEREwith your Mapbox keys.
To ensure that the app is able to build properly after obfuscation, we need to add some proguard rules:
Navigate to
android/app/proguard-rules.pro, create it if neccesaryCopy and paste the below code snippet
The MapsIndoors SDK requires iOS 15, so make sure that your Podfile is configured for iOS 15. Add use_frameworks! inside your app target as well.
Providing
Navigate to your application settings in Xode and add your Mapbox public access token to info with the key MBXAccessTokenSetup your secret access token for downloading the . Read how to do this here: Configure credentials
Last updated
Was this helpful?