7
7

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

Flutter 住所 or 郵便番号から緯度経度を取得する

Posted at

Flutterで住所or名称or郵便番号から緯度経度を取得する

検索しても、なかなか出てこなかったのでメモ代わり

Null Safety 対応バージョン
geocoding: ^2.0.0

Null Safety非対応バージョン
geocoding: ^1.0.5

final searchWord = '東京タワー';
List<Location> locations = await locationFromAddress(searchWord);
print(locations.first.latitude);  // 35.6585805
print(locations.first.longitude); // 139.7454329

final zipCode = '105-0011';
locations = await locationFromAddress(zipCode);
print(locations.first.latitude);  // 35.6571637
print(locations.first.longitude); // 139.7485979
7
7
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
7
7

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?