2

For a project I am doing I really need to find a location or Coordinates. I do not know how to get a Location / coordinates, I dont think that dartium supports many ways of getting locations / coordinates. I am guessing I would use navigator.getLocation but it is not working. Help?

Thanks Luca

LucaSpeedStack
  • 513
  • 2
  • 7
  • 21

1 Answers1

2

According to this bug report (https://code.google.com/p/dart/issues/detail?id=15866) it is not supported.
You need to build to JavaScript and run in Chrome to get the location.

When you use pub serve (as recent DartEditor versions do) you can open the same URL in Chrome you are using in Dartium.

Günter Zöchbauer
  • 623,577
  • 216
  • 2,003
  • 1,567
  • I understand, but how would you find the location in the first place, what is the code for it? – LucaSpeedStack Sep 01 '14 at 15:35
  • http://stackoverflow.com/questions/13394124 Add a comment if it doesn't work. The question is a bit old. This question/answer seems to indicat that it works in Dartium when you provide the API keys http://stackoverflow.com/questions/20824595 – Günter Zöchbauer Sep 01 '14 at 15:38
  • When I use that code, I get an error saying that there is not meant to be any arguments, so when I get rid of the arguments and put it to a string it outputs: Instance of '_Future' Help? – LucaSpeedStack Sep 01 '14 at 15:58
  • 1
    Can you please add the code you used to your question and point out at which statement you get the error. – Günter Zöchbauer Sep 01 '14 at 16:00
  • I was using the code from the link that you gave me, and the statement is: window.navigator.geolocation.getCurrentPosition((Geoposition position) { window.alert(position.coords.latitude.toString()); }); – LucaSpeedStack Sep 01 '14 at 16:05
  • I added a second link to this comment, the code there seems to be more current. Please try this one. – Günter Zöchbauer Sep 01 '14 at 16:07
  • Let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/60402/discussion-between-lucaspeedstack-and-gunter-zochbauer). – LucaSpeedStack Sep 01 '14 at 16:08