0

I'm calling the function window.navigator.geolocation.getCurrentPosition from Dart code. The final parameter to this function is optional. In JavaScript I would set the optional parameters as follows:

var wpid = navigator.geolocation.watchPosition(geo_success, geo_error,
  {enableHighAccuracy:true, maximumAge:30000, timeout:27000});

What would the equivalent be in Dart code? I've tried the following but I'm not sure if it is correct:

window.navigator.geolocation.watchPosition(geo_success, geo_error,
 {'enableHighAccuracy':true, 'maximumAge':30000, 'timeout':27000});

2 Answers 2

1

You are using this method: http://api.dartlang.org/docs/bleeding_edge/dart_html/Geolocation.html#watchPosition

int watchPosition(PositionCallback successCallback, [PositionErrorCallback errorCallback, Object options])

I do not have Dark SDK on this machine, but to me it looks completely fine. If the JavaScript equivalent code is just an object, then passing a Dart Map just like what you have done should be working. Is there a problem with it?

Sign up to request clarification or add additional context in comments.

Comments

0

Hopefully passing a Map works, please try and let us know.

Even if it does work, this is a bad Dart API. The options really should be optional parameters, not properties of an options object. I filed a bug here: http://dartbug.com/6280

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.