搜索插件、代码仓与 APP 分类

插件详情v2.0.2

yandex_mapkit_lite

这是 yandex_mapkit 包版本 3.4.0 的轻量级分支。

AndroidiOS
近 30 天下载
60
喜欢数
37
Pub 分数
130

安装插件

flutter pub add yandex_mapkit_lite

插件介绍

基于插件公开信息、社区数据与项目使用情况整理的选型参考。

yandex_mapkit_lite 是 yandex_mapkit 包(版本 3.4.0)的一个轻量级分支,专为在 Android 和 iOS 上的 Flutter 应用中集成 Yandex 地图而设计。它提供基本的地图功能并减少开销,非常适合需要地图渲染但不希望引入重型依赖的应用。该包保留了核心功能,如地图显示、标记和基本交互,同时优化了性能和包大小。由 surf.ru 开发和维护,为寻求高效地图集成的开发者提供了一个精简的替代方案。

适合场景

  • 在移动应用中集成 Yandex 地图
  • 显示基于位置的数据
  • 创建地图叠加层
  • 轻量级地图解决方案
  • 简单的导航界面

主要特点

  • 减少捆绑包大小
  • 最少依赖
  • 对 Android 和 iOS 的支持
  • 地图渲染和标记
  • 保持核心Yandex地图功能

适合对象

  • 需要轻量级地图解决方案的开发人员
  • 具有严格大小限制的项目
  • 仅使用 Yandex 地图的应用程序
  • 针对 Android 和 iOS 的 Flutter 应用
  • 注重性能和简洁的团队

使用建议

  • 仅限Yandex地图生态系统
  • 无高级路由或地理编码
  • Fork 可能会落后于原始包的更新
  • 需要手动管理依赖项
  • 不适合复杂的映射需求

原始 README

以下为关联源码仓库的 README 原文快照,最新内容请访问源码仓库。

Yandex Mapkit Light

Fork of yandex_mapkit library, but lightweight and more appropriate for the majority of the apps.

Made by Surf 🏄‍♂️🏄‍♂️🏄‍♂️

Build Status Pub Version Pub Likes Pub popularity Flutter Platform License: MIT

yandex mapkit logo

Overview

  • :earth_africa: Map overview - enables to view the map of the world, with which user can interact with any convenient way, usually in order to demonstrate the location of some place
  • :house: Custom map objects - enables for developers to add custom map objects in order to indicate some place on the map
  • :video_game: Convenient map controls - there is an API for straight-to-point map controls through the code - from zooming and moving to limiting user scroll and controlling the speed
  • :leaves: App bundle size reduction - noticeable app bundle size reduction comparing to projects with original package
  • :sparkles: Recommended for use if you don't need anything but basic map

Usage

Generate your API Key

Before you can use MapKit SDK in your application, you need the API key.

  1. Go to the Developer Dashboard.

  2. Log in to your Yandex account or create a new one.

  3. Click Connect APIs and choose MapKit Mobile SDK.

  4. Enter information about yourself and your project, select a pricing plan, and click Continue.

  5. After your API key is successfully created, it will be available in the API Interfaces → MapKit Mobile SDK tab.

Installation

Add yandex_mapkit_lite to your pubspec.yaml file:

dependencies:
  yandex_mapkit_lite: $currentVersion$
Setup for iOS

Specify your API key and locale in ios/Runner/AppDelegate.swift. It should be similar to the following

import UIKit
import Flutter
import YandexMapsMobile

@UIApplicationMain
@objc class AppDelegate: FlutterAppDelegate {
  override func application(
    _ application: UIApplication,
    didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?
  ) -> Bool {
    YMKMapKit.setLocale("YOUR_LOCALE") // Your preferred language. Not required, defaults to system language
    YMKMapKit.setApiKey("YOUR_API_KEY") // Your generated API key
    GeneratedPluginRegistrant.register(with: self)
    return super.application(application, didFinishLaunchingWithOptions: launchOptions)
  }
}

Uncomment platform :ios, '9.0' in ios/Podfile and change to platform :ios, '12.0'

# Uncomment this line to define a global platform for your project
platform :ios, '12.0'
Setup for Android

Add dependency implementation 'com.yandex.android:maps.mobile:4.4.0-lite' to android/app/build.gradle

dependencies {
    implementation 'com.yandex.android:maps.mobile:4.4.0-lite'
}

Specify your API key and locale in your custom application class. If you don't have one the you can create it like so

android/app/src/main/.../MainApplication.java

import android.app.Application;

import com.yandex.mapkit.MapKitFactory;

public class MainApplication extends Application {
    @Override
    public void onCreate() {
        super.onCreate();
        MapKitFactory.setLocale("YOUR_LOCALE"); // Your preferred language. Not required, defaults to system language
        MapKitFactory.setApiKey("YOUR_API_KEY"); // Your generated API key
    }
}

android/app/src/main/.../MainApplication.kt

import android.app.Application

import com.yandex.mapkit.MapKitFactory

class MainApplication: Application() {
  override fun onCreate() {
    super.onCreate()
    MapKitFactory.setLocale("YOUR_LOCALE") // Your preferred language. Not required, defaults to system language
    MapKitFactory.setApiKey("YOUR_API_KEY") // Your generated API key
  }
}

In your android/app/src/main/AndroidManifest.xml Add necessary permissions:

<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />

Comparison with the full version

It is recommended to take into account the drawbacks of this mapkit version.

For app bundle size optimization purposes, the original package was moved to lite version, so some functionality will not be included:

Full version Lite version
Map :white_check_mark: :white_check_mark:
Traffic layer :white_check_mark: :white_check_mark:
Offline maps :white_check_mark: :white_check_mark:
Location manager :white_check_mark: :white_check_mark:
User location layer :white_check_mark: :white_check_mark:
Custom clusterization :x: :white_check_mark: - see the example project
Search, hints, geocoding :white_check_mark: :x: - consider using yandex_geocoder
Automobile, bicycle, and pedestrian routing :white_check_mark: :x:
Routing taking into account public transport :white_check_mark: :x:
Panorama display :white_check_mark: :x:

If your app needs functionality mentioned upper, that is not supported in lite version, consider using full version.

Issues

Minimal versions

There is OS version and platform restrictions for this package. The table for supported platforms and versions of their OS is presented lower:

Android iOS
Support SDK 21+ iOS 12+
Localizations

Mapkit can be used with one language only at the same time.

Due to native constraints after the application is launched language can't be changed.

Android
Example

Example project is soon to be refactored.

Hybrid Composition

By default android views are rendered using Hybrid Composition. In order to render the YandexMap widget on Android using Virtual Display (old composition), set [AndroidYandexMap.useAndroidViewSurface] to false before using YandexMap widget.

AndroidYandexMap.useAndroidViewSurface = false;
Terms of use

Disclaimer: This project uses Yandex Mapkit which belongs to Yandex. When using Mapkit refer to these terms of use.

Credits to Unact.

Contribute

To report your issues, submit them directly in the Issues section.

If you would like to contribute to the package (e.g. by improving the documentation, fixing a bug or adding a cool new feature), please read our contribution guide first and send us your pull request.

Your PRs are always welcome.

How to reach us

Please feel free to ask any questions about this package. Join our community chat on Telegram. We speak English and Russian. Telegram

所属分类

依赖

依赖清单 3 项

源码仓库

使用此插件的项目

暂无相关数据。