Skip to main content

Flutter Native - Getting started

This guide walks you through installing and configuring the Wemap Flutter SDK, and displaying your first map.


Prerequisites

Before you begin, ensure you have the following:

RequirementVersion
Flutter3.35.0 or higher
Dart SDK>= 3.9.0 < 4.0.0
AndroidminSdkVersion 24
iOS13.0 or higher

You'll also need:

  • A valid Map ID and tokencontact Wemap if you do not have them yet

The Flutter package is on pub.dev.


Installation

Add the dependency

Add the SDK to your pubspec.yaml:

dependencies:
wemap_sdk_flutter: ^0.29.0

Or install via command line:

flutter pub add wemap_sdk_flutter

Then fetch dependencies:

flutter pub get

Platform setup

Android

  1. Add repository — In android/build.gradle, add the Wemap Maven repository inside the allprojectsrepositories block:
allprojects {
repositories {
google()
mavenCentral()
// Wemap Maven repository
maven {
url "https://s3.eu-west-1.amazonaws.com/mobile.getwemap.com/releases/android"
}
}
}
  1. Set minSdkVersion — In android/local.properties:
flutter.minSdkVersion=24
  1. Use minSdkVersion in app — In android/app/build.gradle, inside defaultConfig:
defaultConfig {
minSdkVersion localProperties.getProperty('flutter.minSdkVersion').toInteger()
// ... other config
}

iOS

The plugin supports Swift Package Manager (SPM) and CocoaPods. Prefer SPM when you can.

Enable SPM for your Flutter app (per project):

# pubspec.yaml
flutter:
config:
enable-swift-package-manager: true

Or globally:

flutter config --enable-swift-package-manager

Set the iOS deployment target to 13.0 or higher, then run flutter pub get and build. No Wemap CocoaPods sources or extra gems are required for this path.

Option B — CocoaPods

  1. Add sources to Podfile — At the top of ios/Podfile:
source 'https://cdn.cocoapods.org/'
source 'https://github.com/wemap/cocoapods-specs.git'
  1. Set platform version:
platform :ios, '13.0'
  1. Enable BUILD_LIBRARY_FOR_DISTRIBUTION — Add or update the post_install block:
post_install do |installer|
installer.pods_project.targets.each do |target|
flutter_additional_ios_build_settings(target)
target.build_configurations.each do |config|
config.build_settings['BUILD_LIBRARY_FOR_DISTRIBUTION'] = 'YES'
end
end
end
  1. Install gems — Create a Gemfile in the project root:
source 'https://rubygems.org'

gem 'cocoapods'
gem 'cocoapods-s3-download'

Then run bundle install and cd ios && pod install. When upgrading an existing install, use pod update.


Your first map

Here is a minimal example that displays a Wemap map:

import 'package:flutter/material.dart';
import 'package:wemap_sdk_flutter/wemap_sdk_flutter.dart';

void main() {
runApp(const MyApp());
}

class MyApp extends StatelessWidget {
const MyApp({super.key});


Widget build(BuildContext context) {
return MaterialApp(
home: Scaffold(
appBar: AppBar(title: const Text('Wemap Sample')),
body: const MapScreen(),
),
);
}
}

class MapScreen extends StatelessWidget {
const MapScreen({super.key});

void _onMapReady(MapData mapData, MapManager mapManager) {
debugPrint('Map ready: ${mapData.id}');
}


Widget build(BuildContext context) {
return WemapMap(
options: MapOptions(
mapID: yourMapId, // Replace with your Wemap map ID
token: yourToken, // Replace with your token
environment: Environment.PROD,
),
onMapReady: _onMapReady,
);
}
}

Required options

Only three options are required to display a map:

  • mapID — Your Wemap map identifier (integer)
  • token — Authentication token
  • environmentEnvironment.PROD or Environment.DEV

Everything else (location source, offline mode, VPS settings, etc.) has sensible defaults and is covered in Part 2.

Run the app

flutter run

You should see the map load with the default view. The onMapReady callback is called when the map data is loaded and the map is interactive.


Troubleshooting

IssueSolution
pub get failsUse wemap_sdk_flutter from pub.dev (flutter pub add wemap_sdk_flutter), then flutter pub get
Android build failsVerify the Wemap Maven repository is added in android/build.gradle and the device has network access
iOS / SPM build failsConfirm enable-swift-package-manager: true (or Flutter SPM is enabled), then flutter clean and flutter pub get
iOS pod install fails (CocoaPods)Run bundle install first; ensure cocoapods-s3-download is installed and Wemap pod sources are in the Podfile
Map does not loadCheck your Map ID and token are valid and the device has network access

For more help, visit developers.getwemap.com or contact Wemap.