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 Wemap account and a valid Map ID
  • Credentials (access key, secret key, region) from the Wemap team — contact Wemap to obtain them

Installation

1. Configure credentials

The Wemap SDK is distributed via a private package host. Set these environment variables with the credentials provided by Wemap:

export AWS_ACCESS_KEY_ID=your_access_key
export AWS_SECRET_ACCESS_KEY=your_secret_key
export AWS_REGION=your_region

Note: You must provide your Flutter team email to Wemap to receive permissions for the SDK.

2. Add the dependency

Log in to the package host using the same email you provided to Wemap:

dart pub global activate onepub
onepub login

Add the SDK to your pubspec.yaml:

dependencies:
wemap_sdk_flutter:
hosted: https://onepub.dev/api/supddavuhn
version: ^0.27.0

Or install via command line:

onepub pub add wemap_sdk_flutter

Then fetch dependencies:

flutter pub get

Platform setup

Android

  1. Add repositories — In android/build.gradle, add these repositories inside the allprojectsrepositories block:
allprojects {
repositories {
// ... existing repositories
maven { url "https://dist.nao-cloud.com/android/maven/" }
maven {
url "s3://mobile-dev.getwemap.com/wemap/sdk/android"
credentials(AwsCredentials) {
accessKey String.valueOf(System.getenv("AWS_ACCESS_KEY_ID"))
secretKey String.valueOf(System.getenv("AWS_SECRET_ACCESS_KEY"))
}
}
}
}
  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

  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.


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 failsEnsure credentials are set and you've logged in with onepub login
Android build failsVerify AWS credentials are available to Gradle (same shell or CI secrets)
iOS pod install failsRun bundle install first; ensure cocoapods-s3-download gem is installed
Map does not loadCheck your Map ID is valid and the device has network access

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