### Initialize Map with Camera Position Source: https://github.com/mappls-api/mappls-flutter-sdk/blob/main/docs/v2.0.1/Map-Camera.md Set the initial camera position when the map is first loaded. This defines the starting target, zoom level, and orientation. ```dart static final CameraPosition _kInitialPosition = const CameraPosition( target: LatLng(25.321684, 82.987289), zoom: 10.0, ); MapplsMap( initialCameraPosition: _kInitialPosition, ) ``` -------------------------------- ### Import Mappls Nearby Widget Source: https://github.com/mappls-api/mappls-flutter-sdk/blob/main/docs/v2.0.1/Nearby-Widget.md Import the Mappls Nearby Widget package into your Dart code to start using its functionalities. ```dart import 'package:mappls_nearby_plugin/mappls_nearby_plugin.dart'; ``` -------------------------------- ### Place Picker Integration Source: https://github.com/mappls-api/mappls-flutter-sdk/blob/main/docs/v2.0.1/Place-Autocomplete-Widget.md This snippet demonstrates how to open the Place Picker and handle the selected place. It also shows how to use PickerOption to customize the picker's behavior. ```APIDOC ## Place Picker Use method `openPlacePicker` to open Place Picker: ```dart try { Place place = await openPlacePicker(PickerOption(includeSearch: true)); print(json.encode(place.toJson())); } on PlatformException { } ``` You can use `PickerOption` to set the properties of the widget: 1. `includeDeviceLocationButton(bool)`: To enable/ disable current location functionality 2. `includeSearch(bool)`: To provide opions for search locations 3. `mapMaxZoom(double)`: To set maximum zoom level of the map 4. `mapMinZoom(double)`: To set minimum zoom level of the map 5. `placeOptions(PlaceOptions)`: To set all the properties of search widget​ 6. `toolbarColor(String)`: To set the toolbar color of place widget 7. `marker(Uint8List)`: To change the marker image which is visible in the centre of a map 8. `statingCameraPosition(CameraPosition)`: To open a map that sets in camera poition you can set zoom, centre, bearing etc., 9. `startingBounds(LatLngBounds)`: To open a map in a bound ``` -------------------------------- ### Configure Mappls Web SDK Source: https://github.com/mappls-api/mappls-flutter-sdk/blob/main/docs/v2.0.1/Add-Mappls-SDK.md Include the required JavaScript and CSS files in the head section of your web/index.html file. Replace with your actual access token. ```html ``` -------------------------------- ### Import Direction Widget in Dart Source: https://github.com/mappls-api/mappls-flutter-sdk/blob/main/docs/v2.0.1/Direction-Ui.md Import the Mappls Direction Widget package into your Dart code to start using its functionalities. ```dart import 'package:mappls_direction_plugin/mappls_direction_plugin.dart'; ``` -------------------------------- ### Place Autocomplete Source: https://github.com/mappls-api/mappls-flutter-sdk/blob/main/docs/v2.0.1/Place-Autocomplete-Widget.md Use the `openPlaceAutocomplete` method to launch the Place Autocomplete widget. Configure its behavior using `PlaceOptions`. ```APIDOC ## Place Autocomplete Use method `openPlaceAutocomplete` to open Place Autocomplete Widget: ```dart // Platform messages may fail, so we use a try/catch PlatformException. try { ELocation eLocation = await openPlaceAutocomplete(PlaceOptions(enableTextSearch: true,hint: "search Location")); print(json.encode(eLocation.toJson())); } on PlatformException { } ``` You can use `PlaceOptions` to set the properties of the widget: 1. `filter(String)`: this parameter helps you restrict the result either by mentioning a bounded area or to certain mappls pin (6 digit code to any poi, locality, city, etc.), below mentioned are the both types: - `filter` = bounds: lat1, lng1; lat2, lng2 (latitude, longitude) {e.g. filter: "bounds: 28.598882, 77.212407; 28.467375, 77.353513"} - `filter` = cop: {mapplsPin} (string) {e.g. filter: "cop:YMCZ0J"} 2. `hint(String)`: To set the hint on the Search view of the widget. 3. `historyCount(int)`: Maximum number of history results appear 4. `pod(String)`: it takes in the place type code which helps in restricting the results to certain chosen type. **Below mentioned are the codes for the pod**: - AutoSuggestCriteria.POD_SUB_LOCALITY - AutoSuggestCriteria.POD_LOCALITY - AutoSuggestCriteria.POD_CITY - AutoSuggestCriteria.POD_VILLAGE - AutoSuggestCriteria.POD_SUB_DISTRICT - AutoSuggestCriteria.POD_DISTRICT - AutoSuggestCriteria.POD_STATE - AutoSuggestCriteria.POD_SUB_SUB_LOCALITY 5. `backgroundColor(String)`: Background color of search widget 6. `toolbarColor(String)`: to set the toolbar color of the widget. 7. `saveHistory(bool)`: If it sets to `true` it shows the history selected data 8. `tokenizeAddress(bool)`: provides the different address attributes in a structured object. 9. `zoom(double)`: takes the zoom level of the current scope of the map (min: 4, max: 18). 10. `location(LatLng)`: set location around which your search will appear 11. `attributionHorizontalAlignment(int)`: To set the vertical alignment for attribution. **Below mentioned are the values:** - PlaceOptions.GRAVITY_LEFT - PlaceOptions.GRAVITY_CENTER - PlaceOptions.GRAVITY_RIGHT 12. `attributionVerticalAlignment(int)`: To set the horizontal alignment for attribution. **Below mentioned are the values:** - PlaceOptions.GRAVITY_TOP - PlaceOptions.GRAVITY_BOTTOM 13. `logoSize(int)`: To set the logo size. **Below mentioned are the values:** - PlaceOptions.SIZE_SMALL - PlaceOptions.SIZE_MEDIUM - PlaceOptions.SIZE_LARGE 14. `debounce(int)`: This means that the the search apis is hit only debounce value. This is made to control the api hits from SDK parameter. It takes values in milliseconds. Minimum value is 0 and Maximum value is 1500. ``` -------------------------------- ### Retrieve Place Details in Flutter Source: https://github.com/mappls-api/mappls-flutter-sdk/blob/main/docs/v2.0.1/Search-Api.md Demonstrates how to fetch place details using a MapplsPin with both async/await and Future-based approaches. ```dart try { PlaceDetailResponse? response = await MapplsPlaceDetail(mapplsPin: "MMI000").callPlaceDetail(); } catch(e) { PlatformException map = e as PlatformException; print(map.code); } //OR MapplsPlaceDetail(mapplsPin: "MMI000").callPlaceDetail().then((response) { //Handle response },onError: (e) { print(e.code); }).onError((error, stackTrace) => {}); ``` -------------------------------- ### Calculate Driving Directions Source: https://github.com/mappls-api/mappls-flutter-sdk/blob/main/docs/v2.0.1/Routing-Api.md Demonstrates how to request route directions using async/await or then/onError patterns. ```dart try { DirectionResponse? directionResponse = await MapplsDirection(origin: LatLng(28.594475, 77.202432),destination: LatLng(28.554676, 77.186982)).callDirection(); } catch(e) { PlatformException map = e as PlatformException; print(map.code); } ``` ```dart MapplsDirection(origin: LatLng(28.594475, 77.202432),destination: LatLng(28.554676, 77.186982)).callDirection().then((response) { //Handle response },onError: (e) { print(e.code); }).onError((error, stackTrace) => {}); ``` -------------------------------- ### Open Place Autocomplete Widget Source: https://github.com/mappls-api/mappls-flutter-sdk/blob/main/docs/v2.0.1/Place-Autocomplete-Widget.md Use the openPlaceAutocomplete method to trigger the search interface. Wrap the call in a try/catch block to handle potential platform exceptions. ```dart // Platform messages may fail, so we use a try/catch PlatformException. try { ELocation eLocation = await openPlaceAutocomplete(PlaceOptions(enableTextSearch: true,hint: "search Location")); print(json.encode(eLocation.toJson())); } on PlatformException { } ``` -------------------------------- ### Open Place Picker in Flutter Source: https://github.com/mappls-api/mappls-flutter-sdk/blob/main/docs/v2.0.1/Place-Autocomplete-Widget.md Use the openPlacePicker method to launch the widget and handle the returned Place object. Wrap the call in a try-catch block to handle potential PlatformException errors. ```dart try { Place place = await openPlacePicker(PickerOption(includeSearch: true)); print(json.encode(place.toJson())); } on PlatformException { } ``` -------------------------------- ### Open Direction Widget Source: https://github.com/mappls-api/mappls-flutter-sdk/blob/main/docs/v2.0.1/Direction-Ui.md This snippet demonstrates how to open the Direction Widget using the `openDirectionWidget` method. It includes basic error handling for platform exceptions. ```APIDOC ## POST /mappls-api/mappls-flutter-sdk/openDirectionWidget ### Description Opens the Direction Widget to display routes and navigation options. ### Method POST ### Endpoint /mappls-api/mappls-flutter-sdk/openDirectionWidget ### Parameters #### Request Body - **directionOptions** (DirectionOptions) - Required - Options to configure the direction widget. ### Request Example ```json { "directionOptions": { "resource": "DirectionsCriteria.RESOURCE_ROUTE", "showAlternative": true, "profile": "DirectionsCriteria.PROFILE_DRIVING", "overview": "DirectionsCriteria.OVERVIEW_FULL", "steps": false, "excludes": ["DirectionsCriteria.EXCLUDE_TOLL"], "showStartNavigation": true, "destination": { "location": {"lat": 28.6139, "lng": 77.2090}, "mapplsPin": "SOME_MAPPLS_PIN", "placeName": "Some Place Name", "placeAddress": "Some Place Address" }, "searchPlaceOption": {} } } ``` ### Response #### Success Response (200) - **directionCallback** (DirectionCallbcak) - Callback object containing information about the direction. #### Response Example ```json { "directionCallback": { "some_property": "some_value" } } ``` ``` -------------------------------- ### Open Nearby Widget and Handle Results Source: https://github.com/mappls-api/mappls-flutter-sdk/blob/main/docs/v2.0.1/Nearby-Widget.md Use the `openNearbyWidget` method to launch the widget. Ensure to handle potential `PlatformException` errors. ```dart // Platform messages may fail, so we use a try/catch PlatformException. try { NearbyResult nearbyResult = await openNearbyWidget(); } on PlatformException { } ``` -------------------------------- ### DirectionOptions Configuration Source: https://github.com/mappls-api/mappls-flutter-sdk/blob/main/docs/v2.0.1/Direction-Ui.md Details on how to configure the `DirectionOptions` object to customize the behavior of the Direction Widget. ```APIDOC ## DirectionOptions ### Description Configuration object for the Direction Widget. ### Properties #### `resource` (String) Specifies the type of route calculation. - **DirectionsCriteria.RESOURCE_ROUTE** (Default): Calculates route and duration without traffic. - **DirectionsCriteria.RESOURCE_ROUTE_ETA**: Gets updated duration considering live traffic (India only). Requires `region=ind` and `rtype=1` is not supported. - **DirectionsCriteria.RESOURCE_ROUTE_TRAFFIC**: Searches for routes considering live traffic (India only). Requires `region=ind` and `rtype=1` is not supported. #### `showAlternative` (Boolean) Determines whether to display alternative routes. (Default: `false`) #### `profile` (String) Specifies the routing profile. - **DirectionsCriteria.PROFILE_DRIVING** (Default): For car routing. - **DirectionsCriteria.PROFILE_WALKING**: For pedestrian routing (restricted to `route_adv`, `region` & `rtype` not supported). - **DirectionsCriteria.PROFILE_BIKING**: For two-wheeler routing (restricted to `route_adv`, `region` & `rtype` not supported). - **DirectionsCriteria.PROFILE_TRUCKING**: For truck routing (restricted to `route_adv`, `region` & `rtype` not supported). #### `overview` (String) Controls the geometry overview of the route. - **DirectionsCriteria.OVERVIEW_FULL**: Full overview geometry. - **DirectionsCriteria.OVERVIEW_FALSE**: No overview geometry. - **DirectionsCriteria.OVERVIEW_SIMPLIFIED**: Simplified overview geometry. #### `steps` (Boolean) Determines whether to return route steps for each leg. (Default: `false`) #### `excludes` (List) Additive list of road classes to avoid. - **DirectionsCriteria.EXCLUDE_FERRY** - **DirectionsCriteria.EXCLUDE_MOTORWAY** - **DirectionsCriteria.EXCLUDE_TOLL** #### `showStartNavigation` (Boolean) Shows the 'Start Navigation' button if the origin is the current location. (Default: `false`) #### `destination` (DirectionPoint) Defines the destination for the route. - **`location` (LatLng)**: Latitude and longitude of the destination. - **`mapplsPin` (String)**: Mappls Pin of the destination. - **`placeName` (String)**: Place name of the destination. - **`placeAddress` (String)**: Address of the destination. #### `searchPlaceOption` (PlaceOptions) Properties to set for the search widget. ``` -------------------------------- ### Leg Step Response Parameters Source: https://github.com/mappls-api/mappls-flutter-sdk/blob/main/docs/v2.0.1/Routing-Api.md Parameters returned for each LegStep object within a RouteLeg. ```APIDOC ## Leg Step Response Parameters ### Description Parameters returned for each LegStep object within a RouteLeg. ### Parameters #### Leg Step Result Parameters - **distance** (double) - The distance of travel to the subsequent step, in meters. - **duration** (double) - The estimated travel time, in seconds. - **geometry** (double) - The un-simplified geometry of the route segment, depends on the given `geometries` parameter. - **name** (String) - The name of the way along which travel proceeds. - **mode** (String) - Signifies the mode of transportation; driving as default. - **maneuver** (StepManeuver) - A StepManeuver object representing a maneuver. - **drivingSide** (String) - '.Left.' (default) for India, Sri Lanka, Nepal, Bangladesh & Bhutan. - **intersections** (List) - A list of StepIntersection objects that are passed along the segment, the very first belonging to the StepManeuver. ``` -------------------------------- ### Ease Camera to New Position Source: https://github.com/mappls-api/mappls-flutter-sdk/blob/main/docs/v2.0.1/Map-Camera.md Smoothly transition the map camera to a new position with a grounded animation, providing a fluid and immersive camera movement. ```dart controller.easeCamera(CameraUpdate.newCameraPosition(cameraPosition)); ``` -------------------------------- ### Call Nearby Places API in Flutter Source: https://github.com/mappls-api/mappls-flutter-sdk/blob/main/docs/v2.0.1/Search-Api.md Demonstrates how to invoke the Nearby Places search using either async/await or Future chaining. ```dart try { NearbyResponse? nearbyResponse = await MapplsNearby(keyword: "Tea", location: latlng).callNearby(); } catch(e) { PlatformException map = e as PlatformException; print(map.code); } //OR MapplsNearby(keyword: "Tea", location: latlng).callNearby().then((response) { //Handle response },onError: (e) { print(e.code); }).onError((error, stackTrace) => {}); ``` -------------------------------- ### SuggestedPOI Response Parameters Source: https://github.com/mappls-api/mappls-flutter-sdk/blob/main/docs/v2.0.1/Search-Api.md This section outlines the parameters returned in the SuggestedPOI response. ```APIDOC ## SuggestedPOI Response Parameters ### Description This endpoint returns a list of suggested Points of Interest (POIs) with detailed information for each POI. ### Response #### Success Response (200) - **distance** (Integer) - The distance of the POI from the reference point. - **mapplsPin** (String) - The unique Mappls Pin identifier for the POI. - **poi** (String) - The name of the Point of Interest. - **subSubLocality** (String) - The sub-sub-locality of the POI. - **subLocality** (String) - The sub-locality of the POI. - **locality** (String) - The locality of the POI. - **city** (String) - The city where the POI is located. - **subDistrict** (String) - The sub-district of the POI. - **district** (String) - The district where the POI is located. - **state** (String) - The state where the POI is located. - **popularName** (String) - The popular or commonly known name of the POI. - **address** (String) - The full address of the POI. - **telephoneNumber** (String) - The contact telephone number for the POI. - **email** (String) - The contact email address for the POI. - **website** (String) - The official website of the POI. - **longitude** (double) - The longitude coordinate of the POI. - **latitude** (double) - The latitude coordinate of the POI. - **entryLongitude** (double) - The longitude coordinate of the POI's entry point. - **entryLatitude** (double) - The latitude coordinate of the POI's entry point. - **brandCode** (String) - The brand code or identifier for the POI. ### Response Example ```json { "distance": 150, "mapplsPin": "ABC123XYZ789", "poi": "Example Cafe", "subSubLocality": "", "subLocality": "Connaught Place", "locality": "Inner Circle", "city": "New Delhi", "subDistrict": "New Delhi", "district": "New Delhi", "state": "Delhi", "popularName": "CP Cafe", "address": "123, Inner Circle, Connaught Place, New Delhi, Delhi 110001", "telephoneNumber": "+91-11-12345678", "email": "info@examplecafe.com", "website": "https://www.examplecafe.com", "longitude": 77.216721, "latitude": 28.612975, "entryLongitude": 77.217000, "entryLatitude": 28.613000, "brandCode": "BRAND001" } ``` ``` -------------------------------- ### Import Mappls Search Widget Source: https://github.com/mappls-api/mappls-flutter-sdk/blob/main/docs/v2.0.1/Place-Autocomplete-Widget.md Import the package into your Dart files to access the widget functionality. ```dart import 'package:mappls_place_widget/mappls_place_widget.dart'; ``` -------------------------------- ### Tracking Mode Configuration Source: https://github.com/mappls-api/mappls-flutter-sdk/blob/main/docs/v2.0.1/Show-User-Location.md Configure how the map camera tracks the user's location using different tracking modes. ```APIDOC ## Tracking Mode ### Description Contains the variety of camera modes which determine how the camera will track the user location. Set the `myLocationTrackingMode` property to define the tracking behavior. ### Method Widget Configuration ### Endpoint N/A (SDK Configuration) ### Parameters #### Widget Parameters - **myLocationTrackingMode** (MyLocationTrackingMode) - Optional - Specifies the camera tracking mode for the user's location. ### Request Example ```dart MapplsMap( initialCameraPosition: _kInitialPosition, myLocationEnabled: true, myLocationTrackingMode: MyLocationTrackingMode.none, // Example: No camera tracking ) ``` ### Response N/A (Configuration) #### Success Response (200) N/A #### Response Example N/A ### Tracking Modes - **MyLocationTrackingMode.none**: No camera tracking. - **MyLocationTrackingMode.tracking**: Camera tracks the device location, no bearing is considered. - **MyLocationTrackingMode.trackingCompass**: Camera tracks the device location, tracking bearing provided by the device compass. - **MyLocationTrackingMode.trackingGps**: Camera tracks the device location, with bearing provided by a normalized `Location#getBearing()`. >> Note: On Slide the Map or if we call any [Camera Controls Function](./Map-Camera.md) then the Tracking Mode is set to `MyLocationTrackingMode.none` ``` -------------------------------- ### Call POI Along Route API in Flutter Source: https://github.com/mappls-api/mappls-flutter-sdk/blob/main/docs/v2.0.1/Search-Api.md Demonstrates how to invoke the POI Along the Route API using both async/await and promise-based syntax. ```dart try { PoiAlongRouteResponse? poiAlongRouteResponse = await MapplsPOIAlongRoute(path: geometry, category: "FODCOF", buffer: 300).callPOIAlongRoute(); } catch(e) { PlatformException map = e as PlatformException; print(map.code); } ``` ```dart MapplsPOIAlongRoute(path: geometry, category: "FODCOF", buffer: 300) .callPOIAlongRoute().then((response) { //Handle response },onError: (e) { print(e.code); }).onError((error, stackTrace) => {}); ``` -------------------------------- ### Step Maneuver Response Parameters Source: https://github.com/mappls-api/mappls-flutter-sdk/blob/main/docs/v2.0.1/Routing-Api.md Parameters returned for a StepManeuver object. ```APIDOC ## Step Maneuver Response Parameters ### Description Parameters returned for a StepManeuver object. ### Parameters #### Step Maneuver Result Parameters - **location** (LatLng) - A Point describing the location of the turn. - **bearingBefore** (double) - The clockwise angle from true north to the direction of travel immediately before the maneuver. - **bearingAfter** (double) - The clockwise angle from true north to the direction of travel immediately after the maneuver. - **type** (String) - An optional string indicating the direction change of the maneuver. - **modifier** (String) - A string indicating the type of maneuver. New identifiers might be introduced without API change. Types unknown to the client should be handled like the '.turn.' type; the existence of correct modifier values is guaranteed. ``` -------------------------------- ### Render Mode Configuration Source: https://github.com/mappls-api/mappls-flutter-sdk/blob/main/docs/v2.0.1/Show-User-Location.md Customize how the user's location is visually represented on the map. ```APIDOC ## Render Mode ### Description Contains the variety of ways the user location can be rendered on the map. Use the `myLocationRenderMode` property to specify the rendering style. ### Method Widget Configuration ### Endpoint N/A (SDK Configuration) ### Parameters #### Widget Parameters - **myLocationRenderMode** (MyLocationRenderMode) - Optional - Specifies how the user location is rendered on the map. ### Request Example ```dart MapplsMap( initialCameraPosition: _kInitialPosition, myLocationEnabled: true, myLocationRenderMode: MyLocationRenderMode.normal, // Example: Normal rendering ) ``` ### Response N/A (Configuration) #### Success Response (200) N/A #### Response Example N/A ### Render Modes - **MyLocationRenderMode.normal**: This mode shows the device location, ignoring both compass and GPS bearing (no arrow rendered). - **MyLocationRenderMode.compass**: This mode shows the device location, as well as an arrow that is considering the compass of the device. - **MyLocationRenderMode.gps**: This mode shows the device location with the icon bearing updated from the `Location` updates being provided to the `LocationComponent`. ``` -------------------------------- ### Move Camera to Bounds Source: https://github.com/mappls-api/mappls-flutter-sdk/blob/main/docs/v2.0.1/Camera-Control.md Moves the camera to encompass a specified geographical bounding box with padding. ```APIDOC ## Move To Bound ### Description This method allows to move the camera towards the target location with view bounds. ### Method Not applicable (SDK method) ### Endpoint Not applicable (SDK method) ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example ```dart const bounds = LatLngBounds(northeast: LatLng(x1!, y1!), southwest: LatLng(x0!, y0!)); controller.moveCamera(CameraUpdate.newLatLngBounds(bounds, top: 40, left: 40, bottom: 40, right: 40)); ``` ### Response None (SDK method) ``` -------------------------------- ### Open Direction Widget in Flutter Source: https://github.com/mappls-api/mappls-flutter-sdk/blob/main/docs/v2.0.1/Direction-Ui.md Use this method to launch the direction widget. Wrap the call in a try-catch block to handle potential PlatformException errors. ```dart // Platform messages may fail, so we use a try/catch PlatformException. try { DirectionCallbcak directionCallback = await openDirectionWidget(directionOptions:options ); } on PlatformException { } ``` -------------------------------- ### Move Camera to Target Source: https://github.com/mappls-api/mappls-flutter-sdk/blob/main/docs/v2.0.1/Camera-Control.md Moves the camera to a specified latitude and longitude. ```APIDOC ## Move To Target ### Description This method allows to move the camera towards the target location. ### Method Not applicable (SDK method) ### Endpoint Not applicable (SDK method) ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example ```dart controller.moveCamera(CameraUpdate.newLatLng(LatLng(latitude, longitude))); ``` ### Response None (SDK method) ``` -------------------------------- ### Location Update Callback Source: https://github.com/mappls-api/mappls-flutter-sdk/blob/main/docs/v2.0.1/Show-User-Location.md This section explains how to receive continuous location updates from the user's device and process them. ```APIDOC ## Location Update Callback ### Description To request continuous location updates, use the `onUserLocationUpdated` callback. This callback provides location data whenever the user's location changes. ### Method Widget Configuration ### Endpoint N/A (SDK Configuration) ### Parameters #### Widget Parameters - **onUserLocationUpdated** (Function) - Optional - A callback function that receives a `location` object containing position, speed, and altitude whenever the user's location is updated. ### Request Example ```dart MapplsMap( initialCameraPosition: _kInitialPosition, myLocationEnabled: true, onUserLocationUpdated: (location) => { print("Position: ${location.position.toString()}, Speed: ${location.speed}, Altitude: ${location.altitude}") }, ) ``` ### Response N/A (Callback) #### Success Response (200) N/A #### Response Example N/A ``` -------------------------------- ### Add Marker Source: https://github.com/mappls-api/mappls-flutter-sdk/blob/main/docs/v2.0.1/Map-Overlay.md Adds a marker to the map using default icon settings. ```dart Symbol symbol = await controller.addSymbol(SymbolOptions(geometry: LatLng(25.321684, 82.987289))); ``` -------------------------------- ### Zoom Camera To Source: https://github.com/mappls-api/mappls-flutter-sdk/blob/main/docs/v2.0.1/Camera-Control.md Sets the camera's zoom level to a specific value. ```APIDOC ## Zoom To ### Description This method allows to zoom the camera to a particular zoom-level. Example, 18/14 etc. ### Method Not applicable (SDK method) ### Endpoint Not applicable (SDK method) ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example ```dart controller.moveCamera(CameraUpdate.zoomTo(zoom)); ``` ### Response None (SDK method) ``` -------------------------------- ### Auto Suggest API Source: https://github.com/mappls-api/mappls-flutter-sdk/blob/main/docs/v2.0.1/Search-Api.md The Autosuggest API helps users to complete queries faster by adding intelligent search capabilities to your web or mobile app. ```APIDOC ## Auto Suggest ### Description The Autosuggest API helps users to complete queries faster by adding intelligent search capabilities to your web or mobile app. This API returns a list of results as well as suggested queries as the user types in the search field. ### Parameters #### Mandatory Parameter - **query** (String) - Required - e.g. Shoes, Coffee, Versace, Gucci, H&M, Adidas, Starbucks, B130 {POI, House Number, keyword, tag}. #### Optional Parameters - **location** (LatLng) - Optional - Location is required to get location bias autosuggest results. - **tokenizeAddress** (bool) - Optional - Provides the different address attributes in a structured object. - **pod** (String) - Optional - Place type code to restrict results (e.g., AutoSuggestCriteria.POD_CITY). - **filter** (String) - Optional - Restrict result by bounded area (bounds: lat1, lng1; lat2, lng2) or mappls pin (cop: {mappls pin}). ### Response - **suggestedLocations** (List) - A List of the suggested location - **userAddedLocations** (List) - List of usr added locations - **suggestedSearches** (List) - List of suggestion related to your search. ``` -------------------------------- ### Configure Camera Tracking Mode Source: https://github.com/mappls-api/mappls-flutter-sdk/blob/main/docs/v2.0.1/Show-User-Location.md Set the myLocationTrackingMode property to define how the camera follows the user's location. Note that manual map interaction resets this to none. ```dart MapplsMap( initialCameraPosition: _kInitialPosition, myLocationEnabled: true, myLocationTrackingMode: MyLocationTrackingMode.none, ) ``` -------------------------------- ### PageInfo Parameters Source: https://github.com/mappls-api/mappls-flutter-sdk/blob/main/docs/v2.0.1/Search-Api.md Parameters related to pagination for search results. ```APIDOC ## PageInfo Parameters ### Parameters - **pageCount** (Integer): The number of pages with results. - **totalHits** (Integer): Total number of places in the results. - **totalPages** (Integer): Total number of pages as per page size and number of results. - **pageSize** (Integer): The number of results per page. ``` -------------------------------- ### Configure Zoom Gesture Source: https://github.com/mappls-api/mappls-flutter-sdk/blob/main/docs/v2.0.1/Map-UI-Settings.md Enable or disable pinch-to-zoom gestures on the map. ```dart MapplsMap( initialCameraPosition: _kInitialPosition, zoomGesturesEnabled: false, ) ``` -------------------------------- ### Zoom In Source: https://github.com/mappls-api/mappls-flutter-sdk/blob/main/docs/v2.0.1/Camera-Control.md Zooms the camera in by one level. ```APIDOC ## Zoom In ### Description This method allows to zoom in. ### Method Not applicable (SDK method) ### Endpoint Not applicable (SDK method) ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example ```dart controller.moveCamera(CameraUpdate.zoomIn()); ``` ### Response None (SDK method) ``` -------------------------------- ### Animate Camera to New Position Source: https://github.com/mappls-api/mappls-flutter-sdk/blob/main/docs/v2.0.1/Map-Camera.md Transition the map camera to a specified position using a flight animation, simulating a smooth, high-altitude movement for a dynamic visual experience. ```dart controller.animateCamera(CameraUpdate.newCameraPosition(cameraPosition)); ``` -------------------------------- ### Handle Map Click Events in Flutter Source: https://github.com/mappls-api/mappls-flutter-sdk/blob/main/docs/v2.0.1/Map-Events.md Use the onMapClick callback to respond to single tap interactions on the map surface. ```dart MapplsMap( initialCameraPosition: _kInitialPosition, onMapClick: (point, latlng) => { Fluttertoast.showToast(msg: latlng.toString()) }, ) ``` -------------------------------- ### Implement AutoSuggest in Flutter Source: https://github.com/mappls-api/mappls-flutter-sdk/blob/main/docs/v2.0.1/Search-Api.md Use MapplsAutoSuggest to retrieve location suggestions based on user input. The API supports both async/await and Future-based callback patterns. ```dart try { AutoSuggestResponse? response = await MapplsAutoSuggest(query: text).callAutoSuggest(); } catch(e) { PlatformException map = e as PlatformException; print(map.code); } //OR MapplsAutoSuggest(query: text).callAutoSuggest().then((response) { //Handle response },onError: (e) { print(e.code); }).onError((error, stackTrace) => {}); ``` -------------------------------- ### Directions Waypoint Response Parameters Source: https://github.com/mappls-api/mappls-flutter-sdk/blob/main/docs/v2.0.1/Routing-Api.md Parameters returned for a DirectionsWaypoint object. ```APIDOC ## Directions Waypoint Response Parameters ### Description Parameters returned for a DirectionsWaypoint object. ### Parameters #### Directions Waypoint Result Parameters - **name** (String) - Name of the street the coordinate snapped to. - **location** (LatLng) - Point describing the snapped location of the waypoint. ``` -------------------------------- ### Move Camera to Target with Zoom Source: https://github.com/mappls-api/mappls-flutter-sdk/blob/main/docs/v2.0.1/Camera-Control.md Moves the camera to a specified latitude and longitude with a fixed zoom level. ```APIDOC ## Move To Target with Zoom ### Description This method allows to move the camera towards the target location with a fixed zoom. ### Method Not applicable (SDK method) ### Endpoint Not applicable (SDK method) ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example ```dart controller.moveCamera(CameraUpdate.newLatLngZoom(LatLng(latitude, longitude), zoom)); ``` ### Response None (SDK method) ``` -------------------------------- ### Move Camera to Bounds Source: https://github.com/mappls-api/mappls-flutter-sdk/blob/main/docs/v2.0.1/Camera-Control.md Adjusts the camera to fit within specified geographic bounds with padding. ```dart const bounds = LatLngBounds(northeast: LatLng(x1!, y1!), southwest: LatLng(x0!, y0!)); controller.moveCamera(CameraUpdate.newLatLngBounds(bounds, top: 40, left: 40, bottom: 40, right: 40)); ``` -------------------------------- ### Perform Reverse Geocoding with Promise Handling Source: https://github.com/mappls-api/mappls-flutter-sdk/blob/main/docs/v2.0.1/Search-Api.md This snippet shows how to use the .then() and .onError() methods to handle the response and potential errors from the reverse geocoding API call. ```dart MapplsReverseGeocode(location: latlng).callReverseGeocode().then((response) { //Handle response },onError: (e) { print(e.code); }).onError((error, stackTrace) => {}); ``` -------------------------------- ### Add Mappls Search Widget Dependency Source: https://github.com/mappls-api/mappls-flutter-sdk/blob/main/docs/v2.0.1/Place-Autocomplete-Widget.md Add the required dependency to your pubspec.yaml file to use the Mappls Search Widget. ```yaml dependencies: mappls_place_widget: ^2.0.0 ``` -------------------------------- ### Update Camera Position with moveCamera Source: https://github.com/mappls-api/mappls-flutter-sdk/blob/main/docs/v2.0.1/Map-Camera.md Immediately update the map's camera to a new position without any animation. Use this for instant camera adjustments. ```dart const cameraPosition = CameraPosition( target: LatLng(25.321684, 82.987289), zoom: 10.0, ); controller.moveCamera(CameraUpdate.newCameraPosition(cameraPosition)); ``` -------------------------------- ### Configure Compass Visibility Source: https://github.com/mappls-api/mappls-flutter-sdk/blob/main/docs/v2.0.1/Map-UI-Settings.md Toggle the visibility of the compass component on the map. ```dart MapplsMap( initialCameraPosition: _kInitialPosition, compassEnabled: false, ) ``` -------------------------------- ### Step Intersection Response Parameters Source: https://github.com/mappls-api/mappls-flutter-sdk/blob/main/docs/v2.0.1/Routing-Api.md Parameters returned for a StepIntersection object. ```APIDOC ## Step Intersection Response Parameters ### Description Parameters returned for a StepIntersection object. ### Parameters #### Step Intersection Result Parameters - **location** (LatLng) - Point describing the location of the turn. - **bearings** (List) - A list of bearing values (e.g. [0,90,180,270]) that are available at the intersection. The bearings describe all available roads at the intersection. - **classes** (List) - Categorised types of road segments e.g. Motorway. - **entry** (List) - A list of entry flags, corresponding in a 1:1 relationship to the bearings. A value of `true` indicates that the respective road could be entered on a valid route. `false` indicates that the turn onto the respective road would violate a restriction. - **in** (Integer) - Index into bearings/entry array. Used to calculate the bearing just before the turn. Namely, the clockwise angle from true north to the direction of travel immediately before the maneuver/passing the intersection. Bearings are given relative to the intersection. To get the bearing in the direction of driving, the bearing has to be rotated by a value of 180. The value is not supplied for depart maneuvers. - **out** (Integer) - Index into the bearings/entry array. Used to extract the bearing just after the turn. Namely, the clockwise angle from true north to the direction of travel immediately after the maneuver/passing the intersection. The value is not supplied for arrive maneuvers. - **lanes** (List) - Array of IntersectionLanes objects that denote the available turn lanes at the intersection. If no lane information is available for an intersection, the `lanes` property will not be present: - **valid** (bool) - Verifying lane info. - **indications** (List) - Indicating a sign of directions like Straight, Slight Left, Right, etc. ``` -------------------------------- ### Set Logo Position Source: https://github.com/mappls-api/mappls-flutter-sdk/blob/main/docs/v2.0.1/Map-UI-Settings.md Define the screen gravity for the map logo using LogoViewPosition constants. ```dart MapplsMap( initialCameraPosition: _kInitialPosition, logoViewPosition: LogoViewPosition.BottomLeft, ) ``` -------------------------------- ### Zoom Out Source: https://github.com/mappls-api/mappls-flutter-sdk/blob/main/docs/v2.0.1/Camera-Control.md Zooms the camera out by one level. ```APIDOC ## Zoom Out ### Description This method allows to zoom out. ### Method Not applicable (SDK method) ### Endpoint Not applicable (SDK method) ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example ```dart controller.moveCamera(CameraUpdate.zoomOut()); ``` ### Response None (SDK method) ``` -------------------------------- ### Routing API Source: https://github.com/mappls-api/mappls-flutter-sdk/blob/main/docs/v2.0.1/Routing-Api.md Calculates driving routes between specified locations, including via points, and considers traffic conditions. ```APIDOC ## POST /routes ### Description Calculates driving routes between specified locations, including via points, based on route type (fastest or shortest), and includes delays for traffic congestion. It is capable of handling additional route parameters like types of roads to avoid and travelling vehicle type. ### Method POST ### Endpoint /routes ### Parameters #### Path Parameters None #### Query Parameters * **profile** (String) - Optional - Specifies the routing profile. Available options: `DirectionsCriteria.PROFILE_DRIVING` (Default), `DirectionsCriteria.PROFILE_WALKING`, `DirectionsCriteria.PROFILE_BIKING`, `DirectionsCriteria.PROFILE_TRUCKING`. * **resource** (String) - Optional - Specifies the resource to retrieve. Available options: `DirectionsCriteria.RESOURCE_ROUTE` (Default), `DirectionsCriteria.RESOURCE_ROUTE_ETA`, `DirectionsCriteria.RESOURCE_ROUTE_TRAFFIC`. * **steps** (Boolean) - Optional - Returns route steps for each route leg. Possible values are `true`/`false`. Defaults to `false`. * **overview** (String) - Optional - Specifies the overview geometry format. Available options: `DirectionsCriteria.OVERVIEW_FULL`, `DirectionsCriteria.OVERVIEW_FALSE`, `DirectionsCriteria.OVERVIEW_SIMPLIFIED`. * **excludes** (List) - Optional - Additive list of road classes to avoid. Available options: `DirectionsCriteria.EXCLUDE_FERRY`, `DirectionsCriteria.EXCLUDE_MOTORWAY`, `DirectionsCriteria.EXCLUDE_TOLL`. * **alternatives** (Boolean) - Optional - Searches for alternative routes. Defaults to `false`. * **radiuses** (List) - Optional - Limits the search to given radius in meters for all way-points including start and end points. * **geometries** (String) - Optional - Changes the route geometry format/density. Available options: `DirectionsCriteria.GEOMETRY_POLYLINE`, `DirectionsCriteria.GEOMETRY_POLYLINE6` (Default). #### Request Body * **origin** (LatLng or mapplsPin String) - Required - The starting point of the route. * **destination** (LatLng or mapplsPin String) - Required - The ending point of the route. * **waypoint** (List) - Optional - A list of intermediate points for the route. ### Request Example ```json { "origin": { "lat": 28.594475, "lng": 77.202432 }, "destination": { "lat": 28.554676, "lng": 77.186982 }, "waypoint": [ { "lat": 28.600000, "lng": 77.210000 } ], "profile": "DirectionsCriteria.PROFILE_DRIVING", "resource": "DirectionsCriteria.RESOURCE_ROUTE_TRAFFIC", "steps": true, "overview": "DirectionsCriteria.OVERVIEW_FULL", "excludes": ["DirectionsCriteria.EXCLUDE_TOLL"], "alternatives": true, "radiuses": [1000.0], "geometries": "DirectionsCriteria.GEOMETRY_POLYLINE" } ``` ### Response #### Success Response (200) * **code** (String) - Indicates the success status of the request. Expected value is "ok" for a successful request. * **routes** (List) - A list of DirectionsRoute objects, each containing route details. * **waypoints** (List) - An array of DirectionsWaypoint objects representing all waypoints in order. #### Response Example ```json { "code": "Ok", "routes": [ { "distance": 5000, "duration": 600, "geometry": "encoded_polyline_string", "legs": [ { "steps": [ { "instruction": "Turn left onto Main St.", "distance": 100, "duration": 10 } ] } ] } ], "waypoints": [ { "location": { "lat": 28.594475, "lng": 77.202432 } }, { "location": { "lat": 28.554676, "lng": 77.186982 } } ] } ``` ``` -------------------------------- ### Marker API Source: https://github.com/mappls-api/mappls-flutter-sdk/blob/main/docs/v2.0.1/Map-Overlay.md Manage map markers, which are annotations displaying icons at specific geographical locations. Markers can be customized with different icons and respond to click events. ```APIDOC ## Marker API ### Description A Marker is an annotation that displays an icon at a specific geographical location on the map. By default, a marker uses a predefined icon, but you can customize it by using the IconFactory to create an icon from any provided image. To add a marker, specify a LatLng position and call addMarker. Since the marker icon is centered on this position, it’s common to add padding around the image to align it visually as needed. Markers are interactive by design — they respond to click events out of the box and are often paired with event listeners to show InfoWindows. An InfoWindow appears automatically when the marker has either a title or snippet assigned, providing additional context or details. ### Add Marker To add the marker with default icon ```dart Symbol symbol = await controller.addSymbol(SymbolOptions(geometry: LatLng(25.321684, 82.987289))); ``` ### Custom Marker To add the marker with custom Icon ```dart /// Adds an asset image to the currently displayed style Future addImageFromAsset(String name, String assetName) async { final ByteData bytes = await rootBundle.load(assetName); final Uint8List list = bytes.buffer.asUint8List(); return controller.addImage(name, list); } await addImageFromAsset("icon", "assets/symbols/custom-icon.png"); Symbol symbol = await controller.addSymbol(SymbolOptions(geometry: LatLng(25.321684, 82.987289), iconImage: "icon")); ``` ### Remove Marker To remove the marker ```dart controller.removeSymbol(symbol); ``` ``` -------------------------------- ### Route Leg Response Parameters Source: https://github.com/mappls-api/mappls-flutter-sdk/blob/main/docs/v2.0.1/Routing-Api.md Parameters returned for each RouteLeg object within the DirectionsRoute response. ```APIDOC ## Route Leg Response Parameters ### Description Parameters returned for each RouteLeg object within the DirectionsRoute response. ### Parameters #### Route Leg Result Parameters - **distance** (double) - The distance of travel to the subsequent legs, in meters. - **duration** (double) - The estimated travel time, in seconds. - **steps** (List) - Returns route steps for each route leg depending upon the `steps` parameter. ``` -------------------------------- ### Configure Map Tilt Gesture Source: https://github.com/mappls-api/mappls-flutter-sdk/blob/main/docs/v2.0.1/Map-UI-Settings.md Enable or disable the ability to tilt the map view. ```dart MapplsMap( initialCameraPosition: _kInitialPosition, tiltGesturesEnabled: false, ) ``` -------------------------------- ### Set Logo Margins Source: https://github.com/mappls-api/mappls-flutter-sdk/blob/main/docs/v2.0.1/Map-UI-Settings.md Adjust the offset of the logo view from the screen edges using a Point object. ```dart MapplsMap( initialCameraPosition: _kInitialPosition, logoViewMargins: Point(20, 10), ) ``` -------------------------------- ### Move Camera to Target Source: https://github.com/mappls-api/mappls-flutter-sdk/blob/main/docs/v2.0.1/Camera-Control.md Moves the camera to a specific latitude and longitude coordinate. ```dart controller.moveCamera(CameraUpdate.newLatLng(LatLng(latitude, longitude))); ``` -------------------------------- ### Zoom Camera By Source: https://github.com/mappls-api/mappls-flutter-sdk/blob/main/docs/v2.0.1/Camera-Control.md Adjusts the camera's zoom level by a specified amount. ```APIDOC ## Zoom By ### Description This method allows to zoom the camera to a particular zoom by some amount of zoom level ### Method Not applicable (SDK method) ### Endpoint Not applicable (SDK method) ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example ```dart controller.moveCamera(CameraUpdate.zoomBy(zoom)); ``` ### Response None (SDK method) ``` -------------------------------- ### Call Driving Distance Matrix API with try-catch Source: https://github.com/mappls-api/mappls-flutter-sdk/blob/main/docs/v2.0.1/Routing-Api.md Use this snippet to fetch driving distance and duration from a source to destinations. It includes error handling for platform exceptions. ```dart try { DistanceResponse? response = await MapplsDistanceMatrix(sources: ["77.89,28.777"], destinations: ["MMI000"]).callDistanceMatrix(); } catch(e) { PlatformException map = e as PlatformException; print(map.code); } ``` -------------------------------- ### Show Current Location on Map Source: https://github.com/mappls-api/mappls-flutter-sdk/blob/main/docs/v2.0.1/Show-User-Location.md To display the user's current location on the map, your application must first request and obtain location permissions from the user. This snippet shows how to enable the display of the user's current location. ```APIDOC ## Enable Current Location Display ### Description Use this functionality to enable the display of the user's current location on the map by setting `myLocationEnabled` to `true`. ### Method Widget Configuration ### Endpoint N/A (SDK Configuration) ### Parameters #### Widget Parameters - **myLocationEnabled** (boolean) - Required - Set to `true` to display the user's current location. ### Request Example ```dart MapplsMap( initialCameraPosition: _kInitialPosition, myLocationEnabled: true, ) ``` ### Response N/A (Configuration) #### Success Response (200) N/A #### Response Example N/A ``` -------------------------------- ### Import Mappls Flutter Package Source: https://github.com/mappls-api/mappls-flutter-sdk/blob/main/docs/v2.0.1/Add-Mappls-Map.md Import the Mappls package into your Dart code to use its functionalities. ```dart import 'package:mappls_gl/mappls_gl.dart'; ``` -------------------------------- ### Configure Double Tap Zoom Source: https://github.com/mappls-api/mappls-flutter-sdk/blob/main/docs/v2.0.1/Map-UI-Settings.md Enable or disable the zoom functionality triggered by double-tapping the map. ```dart MapplsMap( initialCameraPosition: _kInitialPosition, doubleClickZoomEnabled: false, ) ``` -------------------------------- ### Move Camera to Target with Zoom Source: https://github.com/mappls-api/mappls-flutter-sdk/blob/main/docs/v2.0.1/Camera-Control.md Moves the camera to a specific coordinate while applying a fixed zoom level. ```dart controller.moveCamera(CameraUpdate.newLatLngZoom(LatLng(latitude, longitude), zoom)); ``` -------------------------------- ### Set Compass Position Source: https://github.com/mappls-api/mappls-flutter-sdk/blob/main/docs/v2.0.1/Map-UI-Settings.md Define the screen gravity for the compass view using CompassViewPosition constants. ```dart MapplsMap( initialCameraPosition: _kInitialPosition, compassViewPosition: CompassViewPosition.BottomLeft, ) ```