OpenStreetMap를 사용하여 장소 검색 및 위치 선택을 가능하게 하는 플러터 패키지로, 모바일 및 웹 애플리케이션에서 지도에 대한 광범위한 사용자 정의 옵션을 제공합니다. 플러터 프로젝트에 원활하게 통합되어 위치 선택을 위한 인터랙티브한 지도 인터페이스를 제공합니다. 안드로이드, iOS, 웹, 맥OS, 윈도우, 리눅스 등 여러 플랫폼을 지원하여 크로스플랫폼 개발에 유용합니다. 개발자는 앱의 디자인과 기능 요구 사항에 맞게 UI와 동작을 맞춤 설정할 수 있습니다.
사용 사례
지도 기반 주소 선택
앱 내 사용자 정의 가능한 위치 선택기
크로스 플랫폼 위치 입력
OpenStreetMap를 사용한 장소 검색
인터랙티브 지도 통합
Flutter의 위치 정보 서비스
주요 기능
OpenStreetMap 통합
높은 사용자 정의 가능한 UI
다중 플랫폼 지원
검색 기능 배치
실시간 위치 선택
사용자 정의 가능한 지도 스타일
적합한 대상
위치 인식 앱을 개발하는 개발자
사용자 정의 지도 인터페이스가 필요한 앱
OpenStreetMap를 사용하는 프로젝트
크로스플랫폼 플러터 애플리케이션
사용자 경험 중심의 위치 선택기
고려 사항
지도 데이터를 위해 인터넷 연결이 필요합니다
OpenStreetMap에 한정됨(구글 지도 제외)
사용자 정의 스타일은 추가 구성이 필요할 수 있습니다
제3자 지도 렌더링에 의존
저사양 기기에서의 성능에 미치는 잠재적 영향
모바일 플랫폼에서는 권한 처리가 적절히 이루어져야 합니다
원본 README
연결된 소스 저장소의 README 원문 스냅샷입니다. 최신 내용은 저장소에서 확인하세요.
location_picker_flutter_map
A comprehensive Flutter package that provides location picking, place search, and map interactions using OpenStreetMap with extensive customization options and clean architecture.
✨ Features
🗺️ Interactive Map: Pan, zoom, and tap to select locations
🔍 Smart Search: Real-time location search with autocomplete suggestions
📍 Current Location: GPS-based location tracking with intelligent permission handling
🎨 Highly Customizable: 50+ customization options organized in configuration classes
🔧 Clean Architecture: Service layer pattern with dedicated classes for different concerns
🌍 Multi-language: RTL support and internationalization
⚡ Performance Optimized: Efficient API calls, debouncing, and resource management
🛡️ Error Handling: Comprehensive error management with user-friendly messages
🔒 Permission Management: Smart permission dialogs with clear explanations
🎯 What's New in v4.0.0
🏗️ Clean Architecture & Service Layer
LocationService: Modern GPS operations with LocationSettings API
GeocodingService: Nominatim API with proper HTTP headers and rate limiting
To add the location_picker_flutter_map to your Flutter application read the instructions. Below are some Android and iOS specifics that are required for the package to work correctly.
Android
Upgrade pre 1.12 Android projects
Since version 5.0.0 this plugin is implemented using the Flutter 1.12 Android plugin APIs. Unfortunately this means App developers also need to migrate their Apps to support the new Android infrastructure. You can do so by following the Upgrading pre 1.12 Android projects migration guide. Failing to do so might result in unexpected behaviour.
AndroidX
The geolocator plugin requires the AndroidX version of the Android Support Libraries. This means you need to make sure your Android project supports AndroidX. Detailed instructions can be found here.
The TL;DR version is:
Add the following to your "gradle.properties" file:
Make sure you set the compileSdkVersion in your "android/app/build.gradle" file to 35:
android {
compileSdkVersion 35
...
}
Make sure you replace all the android. dependencies to their AndroidX counterparts (a full list can be found here: Migrating to AndroidX).
Permissions
On Android you'll need to add either the ACCESS_COARSE_LOCATION or the ACCESS_FINE_LOCATION permission to your Android Manifest. To do so open the AndroidManifest.xml file (located under android/app/src/main) and add one of the following two lines as direct children of the <manifest> tag (when you configure both permissions the ACCESS_FINE_LOCATION will be used by the geolocator plugin):
Starting from Android 10 you need to add the ACCESS_BACKGROUND_LOCATION permission (next to the ACCESS_COARSE_LOCATION or the ACCESS_FINE_LOCATION permission) if you want to continue receiving updates even when your App is running in the background:
Starting from Android 14 (SDK 34) you need to add the FOREGROUND_SERVICE_LOCATION permission (next to the ACCESS_COARSE_LOCATION or the ACCESS_FINE_LOCATION or the ACCESS_BACKGROUND_LOCATION permission) if you want to continue receiving updates even when your App is running in the foreground:
FOREGROUND_SERVICE_LOCATION
NOTE: Specifying the ACCESS_COARSE_LOCATION permission results in location updates with an accuracy approximately equivalent to a city block. It might take a long time (minutes) before you will get your first locations fix as ACCESS_COARSE_LOCATION will only use the network services to calculate the position of the device. More information can be found here.
iOS
On iOS you'll need to add the following entry to your Info.plist file (located under ios/Runner) in order to access the device's location. Simply open your Info.plist file and add the following (make sure you update the description so it is meaningful in the context of your App):
<key>NSLocationWhenInUseUsageDescription</key><string>This app needs access to location when open.</string>
If you don't need to receive updates when your app is in the background, then add a compiler flag as follows: in XCode, click on Pods, choose the Target 'geolocator_apple', choose Build Settings, in the search box look for 'Preprocessor Macros' then add the BYPASS_PERMISSION_LOCATION_ALWAYS=1 flag.
Setting this flag prevents your app from requiring the NSLocationAlwaysAndWhenInUseUsageDescription entry in Info.plist, and avoids questions from Apple when submitting your app.
You can also have the flag set automatically by adding the following to the ios/Podfile of your application:
post_install do |installer|
installer.pods_project.targets.each do |target|
if target.name == "geolocator_apple"
target.build_configurations.each do |config|
config.build_settings['GCC_PREPROCESSOR_DEFINITIONS'] ||= ['$(inherited)', 'BYPASS_PERMISSION_LOCATION_ALWAYS=1']
end
end
end
end
If you do want to receive updates when your App is in the background (or if you don't bypass the permission request as described above) then you'll need to:
Add the Background Modes capability to your XCode project (Project > Signing and Capabilities > "+ Capability" button) and select Location Updates. Be careful with this, you will need to explain in detail to Apple why your App needs this when submitting your App to the AppStore. If Apple isn't satisfied with the explanation your App will be rejected.
Add an NSLocationAlwaysAndWhenInUseUsageDescription entry to your Info.plist (use NSLocationAlwaysUsageDescription if you're targeting iOS <11.0)
When using the requestTemporaryFullAccuracy({purposeKey: "YourPurposeKey"}) method, a dictionary should be added to the Info.plist file.
<key>NSLocationTemporaryUsageDescriptionDictionary</key><dict><key>YourPurposeKey</key><string>The example App requires temporary access to the device's precise location.</string></dict>
The second key (in this example called YourPurposeKey) should match the purposeKey that is passed in the requestTemporaryFullAccuracy() method. It is possible to define multiple keys for different features in your app. More information can be found in Apple's documentation.
NOTE: the first time requesting temporary full accuracy access it might take several seconds for the pop-up to show. This is due to the fact that iOS is determining the exact user location which may take several seconds. Unfortunately this is out of our hands.
On iOS 16 and above you need to specify UIBackgroundModeslocation to receive location updates in the background.
On macOS you'll need to add the following entries to your Info.plist file (located under macOS/Runner) in order to access the device's location. Simply open your Info.plist file and add the following (make sure you update the description so it is meaningfull in the context of your App):
<key>NSLocationUsageDescription</key><string>This app needs access to location.</string>
You will also have to add the following entry to the DebugProfile.entitlements and Release.entitlements files. This will declare that your App wants to make use of the device's location services and adds it to the list in the "System Preferences" -> "Security & Privace" -> "Privacy" settings.
When using the requestTemporaryFullAccuracy({purposeKey: "YourPurposeKey"}) method, a dictionary should be added to the Info.plist file.
<key>NSLocationTemporaryUsageDescriptionDictionary</key><dict><key>YourPurposeKey</key><string>The example App requires temporary access to the device's precise location.</string></dict>
The second key (in this example called YourPurposeKey) should match the purposeKey that is passed in the requestTemporaryFullAccuracy() method. It is possible to define multiple keys for different features in your app. More information can be found in Apple's documentation.
NOTE: the first time requesting temporary full accuracy access it might take several seconds for the pop-up to show. This is due to the fact that macOS is determining the exact user location which may take several seconds. Unfortunately this is out of our hands.
Web
To use the Geolocator plugin on the web you need to be using Flutter 1.20 or higher. Flutter will automatically add the endorsed geolocator_web package to your application when you add the geolocator: ^6.2.0 dependency to your pubspec.yaml.
The following methods of the geolocator API are not supported on the web and will result in a UnsupportedError:
Geolocator Web is available only in secure_contexts (HTTPS). More info about the Geolocator API can be found here.
Windows
To use the Geolocator plugin on Windows you need to be using Flutter 2.10 or higher. Flutter will automatically add the endorsed geolocator_windows package to your application when you add the geolocator: ^8.1.0 dependency to your pubspec.yaml.