Skip to content

Both copy text to your clipboard — Build with AI copies a setup prompt to paste into Claude Code, Cursor, Codex or Copilot; Copy page as Markdown copies this page to paste into a chat. How it works

MapMetrics Flutter SDK

Available

The MapMetrics Flutter SDK is available on pub.dev as the mapmetrics package. API documentation can be found here.

Overview

mapmetrics is a Flutter wrapper around MapLibre Native — it renders MapMetrics Atlas vector tile styles on iOS and Android through a single MapMetricsView widget. It gives you camera control, gesture configuration, style/layer manipulation, feature querying, user location, navigation-route snapping, and offline region downloads.

There is no MapMetrics(...) widget, no MapMetricsController, no CameraPosition, and no LatLng in the shipped package — those types belong to a different (fictional) API and will not compile. The real widget is MapMetricsView, the real controller type is MapController, and coordinates are a Position from the geotypes package (re-exported by mapmetrics), which is longitude first.

Install

yaml
dependencies:
  mapmetrics: ^1.0.6
dart
import 'package:mapmetrics/mapmetrics.dart';

A minimal working map

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

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

  @override
  State<MapScreen> createState() => _MapScreenState();
}

class _MapScreenState extends State<MapScreen> {
  MapController? _controller;

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(title: const Text('MapMetrics Map')),
      body: MapMetricsView(
        options: MapOptions(
          // Position(longitude, latitude) — lng FIRST. Amsterdam:
          initCenter: Position(4.8952, 52.3702),
          initZoom: 12,
          initStyle:
              'https://gateway.mapmetrics-atlas.net/styles/?fileName=YOUR_STYLE_ID/YOUR_STYLE.json&token=YOUR_API_KEY',
        ),
        onMapCreated: (controller) => _controller = controller,
      ),
    );
  }
}

MapMetricsView is the MapMetrics-branded widget — prefer it over the underlying MapLibreMap widget it wraps (same options, same callbacks, plus the MapMetrics attribution mark rendered in the corner).

Where to go next

Other SDKs

Questions?

If you have specific requirements or questions about Flutter support, please reach out to our team.