Baseflow / flutter-geocoding

A Geocoding plugin for Flutter
https://baseflow.com
MIT License
139 stars 71 forks source link

PlatformException Issue on a Flutter #235

Closed nmanaranga closed 3 months ago

nmanaranga commented 6 months ago

Please check the following before submitting a new issue.

Please select affected platform(s)

Steps to reproduce

Position position = await Geolocator.getCurrentPosition(); List placemarks =await placemarkFromCoordinates(position.latitude, position.longitude);

Expected results

{addressName: dummy address , streetName: dummy Street }

Actual results

PlatformException(IO_ERROR, fail, null, null)

Code sample

Code sample Position position = await Geolocator.getCurrentPosition(); List placemarks =await placemarkFromCoordinates(position.latitude, position.longitude);

Screenshots or video

Screenshots or video demonstration [Upload media here]

Version

geocoding 3.0.0

Flutter Doctor output

Doctor output [√] Flutter (Channel stable, 3.22.0, on Microsoft Windows [Version 10.0.19045.4412], locale en-US) • Flutter version 3.22.0 on channel stable at D:\Omobio\HSADRP_\flutter • Upstream repository https://github.com/flutter/flutter.git • Framework revision 5dcb86f68f (11 days ago), 2024-05-09 07:39:20 -0500 • Engine revision f6344b75dc • Dart version 3.4.0 • DevTools version 2.34.3 [√] Windows Version (Installed version of Windows is version 10 or higher) [√] Android toolchain - develop for Android devices (Android SDK version 34.0.0) • Android SDK at C:\Users\namal.l\AppData\Local\Android\Sdk • Platform android-34, build-tools 34.0.0 • ANDROID_HOME = C:\Users\namal.l\AppData\Local\Android\Sdk • ANDROID_SDK_ROOT = C:\Users\namal.l\AppData\Local\Android\Sdk • Java binary at: C:\Program Files\Android\Android Studio\jre\bin\java • Java version OpenJDK Runtime Environment (build 11.0.10+0-b96-7249189) • All Android licenses accepted. [√] Chrome - develop for the web • Chrome at C:\Program Files\Google\Chrome\Application\chrome.exe [X] Visual Studio - develop Windows apps X Visual Studio not installed; this is necessary to develop Windows apps. Download at https://visualstudio.microsoft.com/downloads/. Please install the "Desktop development with C++" workload, including all of its default components [√] Android Studio (version 2020.3) • Android Studio at C:\Program Files\Android\Android Studio • Flutter plugin can be installed from: https://plugins.jetbrains.com/plugin/9212-flutter • Dart plugin can be installed from: https://plugins.jetbrains.com/plugin/6351-dart • Java version OpenJDK Runtime Environment (build 11.0.10+0-b96-7249189) [√] VS Code, 64-bit edition (version 1.82.2) • VS Code at C:\Program Files\Microsoft VS Code • Flutter extension version 3.88.0 [√] Connected device (4 available) • JNY LX2 (mobile) • DKTUT20115000377 • android-arm64 • Android 10 (API 29) • Windows (desktop) • windows • windows-x64 • Microsoft Windows [Version 10.0.19045.4412] • Chrome (web) • chrome • web-javascript • Google Chrome 124.0.6367.208 • Edge (web) • edge • web-javascript • Microsoft Edge 124.0.2478.97 [√] Network resources
nafiskabbo commented 6 months ago

I am getting the same issue here. Error Stacktrace:

[ERROR:flutter/runtime/dart_vm_initializer.cc(41)] Unhandled Exception: PlatformException(IO_ERROR, java.util.concurrent.TimeoutException: Waited 5 seconds (plus 153458 nanoseconds delay) for hha@90eec20[status=PENDING, info=[tag=[ReverseGeocode]]], null, null)

_0 StandardMethodCodec.decodeEnvelope (package:flutter/src/services/message_codecs.dart:648:7)

_1 MethodChannel._invokeMethod (package:flutter/src/services/platform_channel.dart:334:18)

< asynchronous suspension >

_2 GeocodingAndroid.placemarkFromCoordinates (package:geocoding_android/geocoding_android.dart:72:9)

dyuta6 commented 5 months ago

Description PlatformException(IO_ERROR, fail, null, null) when attempting to get placemarks from coordinates.

Affected Platforms Android iOS Steps to Reproduce Retrieve the current position:

dart:

Position position = await Geolocator.getCurrentPosition(); Use the position to get placemarks:

dart:

List placemarks = await placemarkFromCoordinates(position.latitude, position.longitude); Expected Results

json:

{ "addressName": "dummy address", "streetName": "dummy Street" } Actual Results PlatformException(IO_ERROR, fail, null, null)

Code Sample

dart:

import 'package:geolocator/geolocator.dart'; import 'package:geocoding/geocoding.dart';

void getPositionAndAddress() async { try { Position position = await Geolocator.getCurrentPosition(); List placemarks = await placemarkFromCoordinates(position.latitude, position.longitude); print(placemarks); } catch (e) { print(e); } }

Version geocoding: 3.0.0

Flutter Doctor Output:

[√] Flutter (Channel stable, 3.22.0, on Microsoft Windows [Version 10.0.19045.4412], locale en-US) • Flutter version 3.22.0 on channel stable at D:\Omobio\HSADRP_\flutter • Upstream repository https://github.com/flutter/flutter.git • Framework revision 5dcb86f68f (11 days ago), 2024-05-09 07:39:20 -0500 • Engine revision f6344b75dc • Dart version 3.4.0 • DevTools version 2.34.3

[√] Windows Version (Installed version of Windows is version 10 or higher)

[√] Android toolchain - develop for Android devices (Android SDK version 34.0.0) • Android SDK at C:\Users\namal.l\AppData\Local\Android\Sdk • Platform android-34, build-tools 34.0.0 • ANDROID_HOME = C:\Users\namal.l\AppData\Local\Android\Sdk • ANDROID_SDK_ROOT = C:\Users\namal.l\AppData\Local\Android\Sdk • Java binary at: C:\Program Files\Android\Android Studio\jre\bin\java • Java version OpenJDK Runtime Environment (build 11.0.10+0-b96-7249189) • All Android licenses accepted.

[√] Chrome - develop for the web • Chrome at C:\Program Files\Google\Chrome\Application\chrome.exe

[X] Visual Studio - develop Windows apps X Visual Studio not installed; this is necessary to develop Windows apps. Download at https://visualstudio.microsoft.com/downloads/. Please install the "Desktop development with C++" workload, including all of its default components

[√] Android Studio (version 2020.3) • Android Studio at C:\Program Files\Android\Android Studio • Flutter plugin can be installed from: https://plugins.jetbrains.com/plugin/9212-flutter • Dart plugin can be installed from: https://plugins.jetbrains.com/plugin/6351-dart • Java version OpenJDK Runtime Environment (build 11.0.10+0-b96-7249189)

[√] VS Code, 64-bit edition (version 1.82.2) • VS Code at C:\Program Files\Microsoft VS Code • Flutter extension version 3.88.0

[√] Connected device (4 available) • JNY LX2 (mobile) • DKTUT20115000377 • android-arm64 • Android 10 (API 29) • Windows (desktop) • windows • windows-x64 • Microsoft Windows [Version 10.0.19045.4412] • Chrome (web) • chrome • web-javascript • Google Chrome 124.0.6367.208 • Edge (web) • edge • web-javascript • Microsoft Edge 124.0.2478.97

[√] Network resources Additional Context Any additional information or context that might be helpful in diagnosing and fixing the issue.

This template includes all the necessary information to help the maintainers understand and address your issue.

abdelhameed0 commented 5 months ago

same issue here , any solution yet ?

pierinaaguirre-techera commented 4 months ago

Has anyone solved this?

Wassiem-Ibr commented 3 months ago

Same issue here, has anyone found a workaround this issue?

AmmarMohamed21 commented 3 months ago

The issue still exists, it happens the first time the function is used but afterwards it works, downgrading to 2.2.0 stopped the issue completely

TimHoogstrate commented 3 months ago

This plugin uses the free Geocoding services from iOS and Android. IO_ERRORS are generated by those Geocoding services. Timeouts probably are related to internet connections or availability. But most IO_ERRORS are generated by rate limits of those free services. There is no real solution, the rate limits will reset by themselves.

Kind regards,