Links

flutter_map

A versatile mapping package for Flutter. Simple and easy to learn, yet completely customizable and configurable, it's the best choice for mapping in your Flutter app.

Feature Highlights

🗺️ Supports any* map style
We natively support any static raster tile server, including from a web server or even from the local file system or app asset store. No more vendor lock-in!
💪 Stress-free setup and use
Migrating from a commercial library such as Google Maps has never been easier! No more complex platform-specific setup, no more API keys: just add a widget and you're done.
🧩 Wide ecosystem of plugins
In the unlikely event that flutter_map doesn't natively contain something you need, just check to see if there's a community maintained plugin that does what you need!
Add other map features easily
Add polygons, polylines, and markers/pins to your map easily and quickly. Markers support displaying any widget you might want.
How does flutter_map compare to other mapping libraries?
This usually refers to libraries such as 'mapbox_gl' and 'google_maps_flutter'. In most ways, it is better, in some it is worse.
flutter_map wins on:
  • Less vendor lock-in (and potentially reduced costs) You're not locked into a particular tile server with us - choose from hundreds of options, or build your own!
  • Customizability & extensibility Add all sorts of layers to display custom widgets and data on top of your map, and choose from flutter_map's many community maintained plugins to add even more functionality!
  • Ease of use/setup We don't require any API keys or platform specific setup (other than enabling the Internet permission!), so you can get started quicker, and make changes without fear of breaking your release application.
  • Support quality and frequency Most questions are answered and resolved within 12-24 hours, thanks to our dedicated maintainers and community.
However, alternatives may win on:
  • Performance* flutter_map's performance is very adequate for the vast majority of applications, and many big businesses use FM to provide maps in their Flutter app. However, if you're using high-thousands of Markers or Polygons and such like, alternatives may win, purely because they use platform views and GL, and so can do calculations outside of Dart.
  • ... and that's pretty much it 😉

Demonstration

Setting up an interactive and compliant map is simpler than making your lunch-time coffee! It can be accomplished in just under 30 lines and a minute or two to install.
This code snippet demonstrates everything you need for a simple map (in just over 20 lines!), but of course, FM is capable of much more than just this, and you could find yourself lost in the many options available and possibilities opened!
1
import 'package:flutter_map/flutter_map.dart';
2
import 'package:latlong2/latlong.dart';
3
4
@override
5
Widget build(BuildContext context) {
6
return FlutterMap(
7
options: MapOptions(
8
initialCenter: LatLng(51.509364, -0.128928),
9
initialZoom: 9.2,
10
),
11
children: [
12
TileLayer(
13
urlTemplate: 'https://tile.openstreetmap.org/{z}/{x}/{y}.png',
14
userAgentPackageName: 'com.example.app',
15
),
16
RichAttributionWidget(
17
attributions: [
18
TextSourceAttribution(
19
'OpenStreetMap contributors',
20
onTap: () => launchUrl(Uri.parse('https://openstreetmap.org/copyright')),
21
),
22
],
23
),
24
],
25
);
26
}

Get Help

Not quite sure about something? No problem. Please get in touch via any of these methods, and we'll be with you as soon as possible. Please remember that we are volunteers, so we cannot guarantee (fast) support.
Due to time shortages, wait times for feature request implementations are currently extremely long and may not happen at all.
We'd love to have your contributions to add your own or others' pull requests!

FAQs

We get quite a lot of similar questions, so please check if your question is here before you ask!
How can I use a custom map style? How can I prevent POI/labels rotating when the map rotates? How can I remove certain POI/labels from the map?
Unfortunately, this library cannot provide this functionality. It has no control over the tiles displayed in the TileLayer. This is a limitation of the technology, not this library.
This is because raster tiles are just images generated by a 3rd party tile server (dictated by your URL template), and therefore cannot be changed by the library that displays the tiles. Filters can be applied to the entire tile, such as an emulated dark mode, but these effects do not look great.
However, tilesets can be styled. This is the most effective way of using custom styles. These methods may help you with this:
  • You may wish to use a commercial service like Mapbox Studio, which allows you to style multiple tilesets. See Using Mapbox.
  • Alternatively, you can experiment with vector tiles. These are not pre-rendered, and so allow any style you desire to be applied on the fly. See Vector Tiles.
  • Your last option is to serve tiles yourself. See Other Options.
How can I route a user between two locations? Why does the Polyline only go in a straight line between two points?
How can I add a Marker where the user's location is? How can I center the map on the user's location?
This is beyond the scope of flutter_map. However, you can use the community maintained plugin 'flutter_map_location_marker' to do this.
Alternatively, use the 'location' and 'compass' packages to generate a stream of the user's location and heading, and feed that to a Marker using a StreamBuilder.
Why does the map disappear/go grey when I zoom in far? Why does the map stop zooming in even though I know there are more zoom levels?
If tiles are disappearing when you zoom in, the default grey background of the FlutterMap widget will shine through. This usually means that the tile server doesn't support these higher zoom levels.
If you know that there are more tiles available further zoomed in, but flutter_map isn't showing them and scaling a particular zoom level instead, it's likely because the TileLayer.maxNativeZoom property is set too low (it defaults to 19).
To set/change the zoom level at which FM starts scaling tiles, change the TileLayer.maxNativeZoom property. To set/change the max zoom level that can actually be zoomed to (hard limit), use MapOptions.maxZoom.
How can I make the map 3D, or view it as a globe?
Unfortunately, this isn't supported, partially due to lack of time on the maintainer's part to implement this feature, partially due to technical limitations. PRs are welcome!
Last modified 2mo ago