【问题标题】:Finding Location / Coordinates in Dart在 Dart 中查找位置/坐标
【发布时间】:2014-09-01 13:35:10
【问题描述】:

对于我正在做的一个项目,我真的需要找到一个位置或坐标。我不知道如何获取位置/坐标,我认为 dartium 不支持多种获取位置/坐标的方法。我猜我会使用 navigator.getLocation 但它不起作用。帮忙?

谢谢 卢卡

【问题讨论】:

    标签: javascript geolocation dart dartium


    【解决方案1】:

    根据此错误报告 (https://code.google.com/p/dart/issues/detail?id=15866),它不受支持。
    您需要构建到 JavaScript 并在 Chrome 中运行以获取位置。

    当您使用pub serve(就像最近的 DartEditor 版本一样)时,您可以在 Chrome 中打开与在 Dartium 中使用的相同的 URL。

    【讨论】:

    • 我明白了,但是您首先如何找到位置,它的代码是什么?
    • stackoverflow.com/questions/13394124 如果不起作用,请添加评论。这个问题有点老了。当您提供 API 密钥 stackoverflow.com/questions/20824595 时,此问题/答案似乎表明它在 Dartium 中有效
    • 当我使用该代码时,我收到一条错误消息,指出没有任何参数,因此当我摆脱参数并将其放入字符串时,它会输出:Instance of '_Future ' 帮助?
    • 您能否将您使用的代码添加到您的问题中并指出您收到错误的语句。
    • 我使用的是你给我的链接中的代码,声明是:window.navigator.geolocation.getCurrentPosition((Geoposition position) { window.alert(position.coords.latitude.toString ());});
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2012-06-22
    • 2020-01-31
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多