μ¬λ³΄μΈμ!
Geolocator().placemarkFromAddress()μ 맀κ°λ³μ μ£Όμκ° μ¬λ°λ₯΄λ©΄ μ μλν©λλ€.
κ·Έλ¬λ μ£Όμκ° μ¬λ°λ₯΄μ§ μμ΅λλ€(Google μ§λμμ μ°Ύμ μ μμ). μ΄ ν¨μλ " PlatformException (PlatformException(ERROR_GEOCODNG_ADDRESSNOTFOUND, μ 곡λ μ£Όμμ μΌμΉνλ μ’νλ₯Ό μ°Ύμ μ μμ΅λλ€., null)) "μ λ°νν©λλ€.
μ΄ μ¬μ§μ²λΌ
λ°λΌμ μ£Όμκ° μ¬λ°λ₯΄μ§ μμ κ²½μ° 'PlatformException(PlatformException(ERROR_GEOCODNG_ADDRESSNOTFOUND, μ 곡λ μ£Όμμ μΌμΉνλ μ’νλ₯Ό μ°Ύμ μ μμ΅λλ€., null))' μμΈκ° μλ nullμ μ»μΌλ €λ©΄ μ΄λ»κ² ν΄μΌ ν©λκΉ?
μλ νμΈμ, ν΄κ²°νμ ¨λμ?
@NaufalHafizi λ¨μν try...catch λ¬Έμμ λ€μμ μνν μ μμ΅λλ€.
List<Placemark> placemarks = null;
try {
placemarks = await Geolocator().placemarkFromAddress(query);
} on PlatformException catch (e) {
if (e.errorCode == 'ERROR_GEOCODING_ADDRESSNOTFOUND') {
placemarks = null;
} else {
// Don't handle this case so rethrow the exception...
rethrow;
}
}
Geolocator λ²μ 6.0.0μ μΌλΆλ‘ μ§μ€μ½λ© κΈ°λ₯μ μ체 μ μ© νλ¬κ·ΈμΈ μΌλ‘ μ΄λνκ³ Geolocator placemarkFromAddress
λ° placemarkFromCoordinates
μ κ±°νμ΅λλ€.
@NaufalHafizi λ¨μν try...catch λ¬Έμμ λ€μμ μνν μ μμ΅λλ€.
List<Placemark> placemarks = null; try { placemarks = await Geolocator().placemarkFromAddress(query); } on PlatformException catch (e) { if (e.errorCode == 'ERROR_GEOCODING_ADDRESSNOTFOUND') { placemarks = null; } else { // Don't handle this case so rethrow the exception... rethrow; } }
Geolocator λ²μ 6.0.0μ μΌλΆλ‘ μ§μ€μ½λ© κΈ°λ₯μ μ체 μ μ© νλ¬κ·ΈμΈ μΌλ‘ μ΄λνκ³ Geolocator
placemarkFromAddress
λ°placemarkFromCoordinates
μ κ±°νμ΅λλ€.
κ°μ¬ ν΄μ
@NaufalHafizi λ¨μν try...catch λ¬Έμμ λ€μμ μνν μ μμ΅λλ€.
List<Placemark> placemarks = null; try { placemarks = await Geolocator().placemarkFromAddress(query); } on PlatformException catch (e) { if (e.errorCode == 'ERROR_GEOCODING_ADDRESSNOTFOUND') { placemarks = null; } else { // Don't handle this case so rethrow the exception... rethrow; } }
Geolocator λ²μ 6.0.0μ μΌλΆλ‘ μ§μ€μ½λ© κΈ°λ₯μ μ체 μ μ© νλ¬κ·ΈμΈ μΌλ‘ μ΄λνκ³ Geolocator
placemarkFromAddress
λ°placemarkFromCoordinates
μ κ±°νμ΅λλ€.κ°μ¬ ν΄μ
if (e.errorCode == 'ERROR_GEOCODING_ADDRESSNOTFOUND')
μ¬κΈ° '.errorcode'κ° μλνμ§ μμ΅λλ€
getter 'μ€λ₯ μ½λ'κ° 'PlatformException' μ νμ λν΄ μ μλμ§ μμμ΅λλ€.
λΉμ μ κ·Έκ²μ λ³Ό μ μμ΅λλ€.