ola_maps_flutter 0.1.0
ola_maps_flutter: ^0.1.0 copied to clipboard
A Flutter plugin for integrating Ola Maps SDK. Provides interactive maps with markers, polylines, circles, polygons, bezier curves, and marker clustering.
Ola Maps Flutter Plugin #
A Flutter plugin for integrating Ola Maps SDK into your Flutter applications. This plugin provides a comprehensive set of features for displaying interactive maps with markers, polylines, circles, polygons, bezier curves, and marker clustering.

Features #
- ✅ Map Display - Interactive map view with gestures (zoom, pan, tilt, rotate)
- ✅ Markers - Add, remove, and update map markers with custom icons
- ✅ InfoWindows - Display information windows on markers
- ✅ Polylines - Draw routes and paths on the map
- ✅ Circles - Display circular overlays
- ✅ Polygons - Draw multi-sided shapes for area boundaries
- ✅ Bezier Curves - Smooth curved lines between points
- ✅ Marker Clustering - Group nearby markers automatically
- ✅ Camera Controls - Zoom to location, get current position
- ✅ Location Services - Show/hide current user location
Screenshots #
| Map View | Markers & Overlays | Clustering |
|---|---|---|
![]() |
Interactive map with all features | Auto-grouped markers |
Installation #
Add this to your package's pubspec.yaml file:
dependencies:
ola_maps_flutter:
path: path/to/ola_maps_flutter
Android Setup #
1. Add Ola Maps SDK #
Place the OlaMapSdk-1.8.4.aar file in your android/libs/ directory.
In your android/build.gradle:
allprojects {
repositories {
google()
mavenCentral()
flatDir {
dirs 'libs'
}
}
}
In your android/app/build.gradle:
dependencies {
implementation(name: 'OlaMapSdk-1.8.4', ext: 'aar')
}
2. Permissions #
Add these permissions to your AndroidManifest.xml:
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
3. Request Runtime Permissions #
import 'package:permission_handler/permission_handler.dart';
Future<void> requestLocationPermission() async {
await Permission.location.request();
}
Usage #
Basic Map #
import 'package:ola_maps_flutter/ola_map_view_flutter.dart';
OlaMapView(
apiKey: "YOUR_OLA_MAPS_API_KEY",
onMapCreated: (id) {
print("Map created with id: $id");
},
onControllerReady: (controller) {
// Map is ready, controller is available
},
showZoomControls: true,
showCompass: true,
showMyLocationButton: true,
)
Add Markers #
OlaMapController? _controller;
// Add marker
final markerId = await _controller?.addMarker(
position: OlaLatLng(18.5214, 73.9317),
snippet: "Ola Campus",
subSnippet: "Tap for more info",
);
// Remove marker
await _controller?.removeMarker(markerId);
// Update marker
await _controller?.updateMarker(
markerId: markerId,
position: OlaLatLng(18.5220, 73.9320),
rotation: 45.0,
);
Add Polyline #
await _controller?.addPolyline(
points: [
OlaLatLng(18.5214, 73.9317),
OlaLatLng(18.5234, 73.9337),
OlaLatLng(18.5254, 73.9357),
],
color: "#FF0000",
width: 5.0,
);
Add Circle #
await _controller?.addCircle(
center: OlaLatLng(18.5214, 73.9317),
radius: 500.0,
color: "#0000FF",
opacity: 0.3,
);
Add Polygon #
await _controller?.addPolygon(
points: [
OlaLatLng(18.5214, 73.9317),
OlaLatLng(18.5234, 73.9337),
OlaLatLng(18.5254, 73.9357),
OlaLatLng(18.5254, 73.9317),
],
color: "#00FF00",
);
Add Bezier Curve #
await _controller?.addBezierCurve(
startPoint: OlaLatLng(18.5214, 73.9317),
endPoint: OlaLatLng(18.5254, 73.9357),
color: "#FF00FF",
width: 4.0,
);
Camera Controls #
// Zoom to specific location
await _controller?.zoomToLocation(
OlaLatLng(18.5214, 73.9317),
15.0, // zoom level
);
// Get current location
final location = await _controller?.getCurrentLocation();
// Show current location
await _controller?.showCurrentLocation();
Marker Clustering #
final geoJson = '''
{
"type": "FeatureCollection",
"features": [...]
}
''';
await _controller?.addClusteredMarkers(
geoJson: geoJson,
clusterRadius: 50,
defaultMarkerColor: "#FF0000",
defaultClusterColor: "#00FF00",
textSize: 12.0,
textColor: "#FFFFFF",
);
API Reference #
OlaMapController Methods #
| Method | Description |
|---|---|
addMarker() |
Add a marker to the map |
removeMarker() |
Remove a marker by ID |
updateMarker() |
Update marker properties |
showInfoWindow() |
Show info window for marker |
hideInfoWindow() |
Hide info window |
addPolyline() |
Draw a polyline |
addCircle() |
Add a circle overlay |
addPolygon() |
Add a polygon shape |
addBezierCurve() |
Add a curved line |
addClusteredMarkers() |
Add clustered markers from GeoJSON |
zoomToLocation() |
Zoom camera to location |
getCurrentLocation() |
Get device location |
showCurrentLocation() |
Display user location |
hideCurrentLocation() |
Hide user location |
Example App #
See the example directory for a complete working example demonstrating all features.
Requirements #
- Flutter SDK: >=3.0.0
- Android minSdkVersion: 21
- Ola Maps SDK: 1.8.4
License #
MIT License - see LICENSE file for details.
Issues and Feedback #
Please file issues on the GitHub repository.
