Google Maps SDK used to feature a Place Picker. It was deprecated and removed. There is a custom library called PING that implements similar functionality using the Geocoder API. It's expensive.
Yandex Place Picker provides you with the same functionality utilising Yandex MapKit. At no cost.
There is a capability to utilize icons, but Google's icon names differ from Yandex's (and there isn't a full list anywhere to find), which requires manual renaming of all the icons. A few of them (banks, for example) are included. Feel free to contribute with more icons.
Add the dependency to pubspec.yaml file
dependencies:
yandex_place_picker: ^0.1.0
Sign up for MapKit API keys - How to
Follow the configuration instructions for yandex_mapkit
:
- Add
import YandexMapKit
toios/Runner/AppDelegate.swift
- Add
YMKMapKit.setApiKey("YOUR_API_KEY")
insidefunc application
inios/Runner/AppDelegate.swift
- Specify your API key in the application delegate
ios/Runner/AppDelegate.swift
ios/Runner/AppDelegate.swift
:
import UIKit
import Flutter
import YandexMapKit
@UIApplicationMain
@objc class AppDelegate: FlutterAppDelegate {
override func application(
_ application: UIApplication,
didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?
) -> Bool {
YMKMapKit.setApiKey("YOUR_API_KEY")
GeneratedPluginRegistrant.register(with: self)
return super.application(application, didFinishLaunchingWithOptions: launchOptions)
}
- Add dependency
implementation 'com.yandex.android:mapkit:3.4.0'
toandroid/app/build.gradle
- Add
import com.yandex.mapkit.MapKitFactory;
toandroid/app/src/main/.../MainActivity.java
- Add
MapKitFactory.setApiKey("YOUR_API_KEY");
inside methodonCreate
inandroid/app/src/main/.../MainActivity.java
- Specify your API key in the application delegate
android/app/src/main/.../MainActivity.java
android/app/build.gradle
:
dependencies {
…
implementation 'com.yandex.android:mapkit:3.4.0'
}
android/app/src/main/.../MainActivity.java
:
import io.flutter.app.FlutterActivity;
import io.flutter.plugins.GeneratedPluginRegistrant;
import com.yandex.mapkit.MapKitFactory;
public class MainActivity extends FlutterActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
MapKitFactory.setApiKey("YOUR_API_KEY");
GeneratedPluginRegistrant.registerWith(this);
}
}
Check the sample project for a full working example.
import 'package:yandex_place_picker/yandexplacepicker.dart';
…
final Place place = await YandexPlacePicker.selectPlace(context);
You can alter the behavior of the picker by // TODO: Implement configuration
Copyright 2019-2020 Ivan Semkin
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
https://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.