A flutter plugin for displaying yandex maps on iOS and Android. Now fully integrated with flutters widget tree.
Disclaimer: This project uses Yandex Mapkit which belongs to Yandex
When using Mapkit refer to these terms of use
- Go to https://developer.tech.yandex.com
- Create a
MapKit mobile SDK
key
- 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
- Add
<key>io.flutter.embedded_views_preview</key> <true/>
inside<dict>
tag inios/Runner/Info.plist
- Uncomment
platform :ios, '9.0'
inios/Podfile
ios/Runner/AppDelegate.swift
:
For Swift 4.0 and lesser
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)
}
}
For Swift 4.2 and greater
import UIKit
import Flutter
import YandexMapKit
@UIApplicationMain
@objc class AppDelegate: FlutterAppDelegate {
override func application(
_ application: UIApplication,
didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: 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'
andimplementation 'com.yandex.android:search:3.4.0'
toandroid/app/build.gradle
- Add permissions
uses-permission android:name="android.permission.INTERNET
anduses-permission android:name="android.permission.ACCESS_FINE_LOCATION
toandroid/app/src/main/AndroidManifest.xml
- 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 {
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test:runner:1.1.1'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.1'
implementation 'com.yandex.android:mapkit:3.4.0'
implementation 'com.yandex.android:search: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);
}
}
import androidx.annotation.NonNull;
import io.flutter.embedding.android.FlutterActivity;
import io.flutter.embedding.engine.FlutterEngine;
import io.flutter.plugins.GeneratedPluginRegistrant;
public class MainActivity extends FlutterActivity {
@Override
public void configureFlutterEngine(@NonNull FlutterEngine flutterEngine) {
MapKitFactory.setApiKey("YOUR_API_KEY");
GeneratedPluginRegistrant.registerWith(flutterEngine);
}
}
Example:
import 'package:yandex_mapkit/yandex_mapkit.dart';
void main() async {
runApp(MyApp());
}
You can use a YandexMap
which resizes itself to its parent size
Expanded(child: YandexMap())
For usage examples refer to example app
- iOS Support
- Android Support
- Adding and removing Placemarks
- Receive Placemark tap events
- Moving around the map
- Setting map bounds
- Showing current user location
- Styling the map
- Adding and removing Polylines
- Adding and removing Polygons
- Address suggestion