geocode method

  1. @override
Future<MoveGeocodeResult> geocode(
  1. double latitude,
  2. double longitude
)
override

Geocode address lookup at coordinates: (latitude, longitude) Returns a result with a String at MoveGeocodeResult.result or an error with MoveGeocodeResult.error.

Implementation

@override
Future<MoveGeocodeResult> geocode(double latitude, double longitude) async {
  try {
    final result = await methodChannel.invokeMethod<String>('geocode',
        <String, double>{'latitude': latitude, 'longitude': longitude});
    return MoveGeocodeResult(result, null);
  } on PlatformException catch (e) {
    switch (e.code) {
      case "thresholdReached":
        return MoveGeocodeResult(null, MoveGeocodeError.thresholdReached);
      case "serviceUnreachable":
        return MoveGeocodeResult(null, MoveGeocodeError.serviceUnreachable);
      default:
        return MoveGeocodeResult(null, MoveGeocodeError.resolveFailed);
    }
  }
}