Mapping the road ahead…
There was everything special in the Flutter event (this year)..Choosing one out of them, I decided to explore Google Maps…
Asked by developers, delivered by Flutter….
- Add google_maps_flutterin the pubspec.yaml
- Get an API key at https://cloud.google.com/maps-platform/.
- For Android : Specify your API key in the application manifest
For iOS : Specify your API key in the application delegate
Important lines :
[GMSServices provideAPIKey:@”YOUR KEY HERE”]
3. Add import ‘package:google_maps_flutter/google_maps_flutter.dart’; in your main.dart
All geared up….
How to start…
Start with initializing the GoogleMap (a widget)
onMapCreated : Callback which takes GoogleMapController…initialized as
options : An optional widget, can be used for customizing the Google Maps UI configurations..Takes in GoogleMapOptions, some properties such as
scrollGesturesEnabled : if the map should respond to scroll gestures, tiltGesturesEnabled : if the map should respond to tilt gestures,
rotateGesturesEnabled : if the map should respond to tilt gestures,
myLocationEnabled : if a “My Location” layer should be shown on the map,
This layer includes a location indicator at the current device location, as well as a My Location button. Enabling this feature requires adding location permissions to both native platforms of your app.
compassEnabled : if the map should show a compass when rotated,
mapType :type of map tiles to be rendered,
zoomGesturesEnabled : if the map view should respond to zoom gestures,
cameraPosition : used to indicate initial camera position and to update that position programmatically along with other changes to the map user interface,
Changing to the different map types is achieved by mapController’s updateMapOptions and setting to MapType.satellite
Using mapController’s cameraPositionwe can extract the current location.
mapPosition.target.latitude. || mapPosition.target.longitude
Using mapController’s addMarker, passing the position to be marked.
infoWindowText : Contents to be displayed in the marked location,
icon : description of the bitmap used to draw the marker icon
That’s all folks!!!!!Video demonstration :
For complete source code, visit :
Flutter is great and we are greatly encouraged to develop an application similar to your app using Flutter. Check the marvelapp screen prototype -https://marvelapp.com/3265560/screen/37072136
We would like to know how Location is shared on real time basis and which plugins/packages have you can use to achieve it. We would be gratefully indebted for your guidance on this project.
Looking forward for great connection.