getLocation method

Future<Location> getLocation(
  1. LocationClientOptions options
)

只定位一次

Implementation

Future<Location> getLocation(LocationClientOptions options) {
  L.p('getLocation dart端参数: options.toJsonString() -> ${options.toJsonString()}');

  _locationChannel.invokeMethod('location#startLocate', {'options': options.toJsonString()});

  return _locationEventChannel.receiveBroadcastStream().map((result) => result).map((resultJson) => Location.fromJson(jsonDecode(resultJson))).first;
}