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.
Last updated
Why Choose flutter_map?
See why you should use flutter_map for your project:
Setting up an interactive and 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 under 30 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!
import'package:flutter_map/flutter_map.dart';import'package:latlong2/latlong.dart';@overrideWidgetbuild(BuildContext context) {returnFlutterMap( options:MapOptions( initialCenter:LatLng(51.509364, -0.128928), // Center the map over London initialZoom:9.2, ), children: [TileLayer( // Display map tiles from any source urlTemplate:'https://tile.openstreetmap.org/{z}/{x}/{y}.png', // OSMF's Tile Server userAgentPackageName:'com.example.app',// And many more recommended properties! ),RichAttributionWidget( // Include a stylish prebuilt attribution widget that meets all requirments attributions: [TextSourceAttribution('OpenStreetMap contributors', onTap: () =>launchUrl(Uri.parse('https://openstreetmap.org/copyright')), // (external) ),// Also add images... ], ), ], );}
Get Help
Not quite sure about something? No worries, we're here to help!
Check the FAQs below, and double check the documentation
Then, for bug reports & feature requests: check for previous issues, then ask in GitHub Issues
We get quite a lot of similar questions, so please check if your question is here before you ask!
How Does It Work?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?
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 don't any map tiles appear?
If no tiles are appearing (if tiles are appearing on some zoom levels but not others, see below), try performing the following debugging steps:
Is the templateUrl or WMS configuration correct (to the best of your knowledge)?
Have you followed the platform specific setup (Additional Setup) instructions (if applicable for your platform)?
Check the Network tab either in Flutter DevTools or the browser DevTools to see why/if the tile requests are failing.
If none of those solved the issue, check if there are any widgets covering the map, or any errors in the console (particularly in release mode)?
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!