How to find the name and coordinates of the place we are nearby? - flutter

In Flutter what is the most correct method to find the name and coordinates of the place we are inside now using Google Maps or Google Geolocation API?
searchNearbyWithRadius() seems to be such a method, but Java has PlacesClient.findCurrentPlace that seems more stereotypic for this task than searchNearbyWithRadius(). Is such a method available in Flutter (or at least in the REST API)? Please show a reference.

Related

Flutter use "listview" to list nearest location marks

I'm trying to use listview to list nearest "barber" locations on my Firebase. I can get location from the user but unable to find a documentation for this. I'm using Flutter and Dart.
Thanks for your support!
Try geolocator and enter link description here are very easy to use.

Call a Dart const from a String version of its name

I am using Flutter and the FontAwesome library and I need to create icons based on their name. So, I need to get the following:
FaIcon(FontAwesomeIcons.lightWalking);
...but from its name as a String.
Something like this:
FaIcon(FontAwesomeIcons["lightWalking"]); // <== this doesn't work in Dart
I can then build a function to return icons based on the name that I get out of a database.
I don't think this is a dart related question on first sight but rather a FontAwesomeIcons question unless you want to use reflection in dart. You need to access the Icons here which are simply not accessible the way you tried it.
See the following issue:
https://github.com/fluttercommunity/font_awesome_flutter/issues/102
Quote:
Hi, we don't support icon maps officially, but you can use this
generator by calling it in the updater tool. You will need a local
installation of font awesome for this, please follow the instructions
for pro icons and ignore steps that mention icons.json or .ttf files.
If you need further assistance feel free to ask.
That means the way you are trying to access your icons is not supported directly.
However you could use the generator tools to create such a map, iterate it and find a suitable icon. See the FontAwesome example for that (they generated a map and iterated it).
https://github.com/fluttercommunity/font_awesome_flutter/tree/master/example/lib
What might be a little more convenient might be a third party tool which already has such a map and allows you to search it.
https://pub.dev/packages/icons_helper/example
You can then do the following:
getIconUsingPrefix(name: "PREFIX.ICON_NAME")
You can achieve this only using reflection. There is a library called reflectable for Flutter. It will generate some code for you and then you will be able to access the class members of FontAwesomeIcons by their name as String.

How to get current latitude & longitude in google_maps_flutter?

How can I get the LatLng of user's current location when using google_maps_flutter plugin?
I wish there had been something like:
GoogleMap(
onLocationChanged: (latLng) {
// Something like this callback ...
}
)
PS: I don't wish to use any other plugin.
Flutter is a framework which allows you to create UI easily. But behind this technology actually we don't have any native functionality. To bring these functionalities to flutter we have "Method Channel" or "Dart:FFI".
If you look at the source code of plugin which brings native functions to flutter they mostly use "Method Channel".
Google Maps plugin allows you to use google maps api, but however if you want to use or get client location, you must have some native code.
Some 3rd party apps already offer this functionality for you, but if you want to develop it for yourself, you have to write your own code for Android & iOS. Then you need to link it with the flutter. To do this you need to use method channel.
Maybe what you need is the location package from Flutter dev.
With that you can just listen for location changes, and maybe update your current location variable.
Something like:
location.onLocationChanged().listen((LocationData newLoc) {
currentLocation = newLoc;
});
There is no way to get current location from google_maps_flutter plugin, but you can get displaying location either by
GoogleMap(
onCameraMove: (LatLng displayingLocation){
// do operations here
}
)
or by using map controller
mapController.getLatLng(ScreenCoordinate(
x: MediaQuery.of(context).size.width,
y: MediaQuery.of(context).size.height))

How to get road coordinates between two markers google map api

I need to create path exactly according to road coordinates from google map api.I am partially successful with the help of this "http://maps.googleapis.com/maps/api/directions/json?&origin=%#,%#&destination=%#,%#&sensor=false" service.
But this service provide me the coordinates as show in this image .
When we zoom this path it looks like this image .
Actually, I want to get exactly road coordinates with every curve.
Firstly I did this task with the javascript file which was in one of the tutorial of google map (SBMapwithRoute)but don't know why that javascript file stop responding now.
If any body know how this task will perform than please help me.Thank you
I have posted one artical on my blog may be help full check it
http://www.jogendra.com/wayPath
May be hellfull for you
if you wants get waypoints from your google maps waypath. then use this
NSMutableArray *wayPointsArray = [self decodePolyLine:polyline.path.encodedPath];
here decodePolyline is function that you seen on my blog
polyline is object of GMSPolyline *_polyline;
Thnaks

how does the "#" location tag work?

for better understanding check out this link first: http://sxsw.usehipster.com/questions/where-are-the-best-breakfast-tacos-in-austin
as you can see there, some answers have a reference to a location which is show on the map on the right. A user can do that by adding the “#“ symbol before the location name.
I'd like to know how that works. Did the guys from usehipster.com developed that by themselve or is that maybe a framework I can use too?
cheers
Looks custom-made - i.e. not a framework. Shouldn't be too hard - just scan the entry for #\w+, plug that into Google Local Search (possibly specify the city), and plug the output into a Google Map. See e.g. this for an example of Google Local Search API: http://code.google.com/apis/ajax/playground/?exp=localsearch#the_hello_world_of_local_search