Installation
In the event that the
LatLng
object provided by that library conflicts with another, for example the one provided by Google Maps, you may need to use the 'as' suffix.Just import the package as you would normally, from the command line:
flutter pub add flutter_map
flutter pub add latlong2
Commits available from Git (GitHub) may not be stable. Only use this method if you have no other choice.
If you urgently need the latest version, a specific branch, or a specific fork, you can use this method.
pubspec.yaml
dependency_overrides:
flutter_map:
git:
url: https://github.com/fleaflet/flutter_map.git
# ref: main (custom branch/commit)
Always force usage of the CanvasKit renderer instead of the HTML renderer, even on mobile devices.
Failure to do so leads to severely impacted performance and some broken features.
For more information about web renderers, see https://docs.flutter.dev/platform-integration/web/renderers.
flutter_map needs to access the Internet to load tiles, in most cases. On Android, apps must include the INTERNET permission in their manifest. Add the following line to all manifests:
AndroidManifest.xml
<uses-permission android:name="android.permission.INTERNET"/>
flutter_map needs to access the Internet to load tiles, in most cases. On MacOS, apps must include a dedicated entitlement. Add the following lines to 'macos/Runner/DebugProfile.entitlements' and 'macos/Runner/Release.entitlements':
*.entitlements
<key>com.apple.security.network.client</key>
<true/>
After installing the package, import it into the necessary files in your project:
import 'package:flutter_map/flutter_map.dart';
import 'package:latlong2/latlong.dart';
import 'package:flutter_map/plugin_api.dart'; // Only import if required functionality is not exposed by default
Before continuing with usage, make sure you comply with the appropriate rules and ToS for your server. Some have stricter rules than others. This package or the creator(s) are not responsible for any violations you make using this package.
Last modified 3mo ago