image_picker_android

0.8.13+25

Android implementation of the image_picker plugin.

Download archive

Readme

image_picker_android

The Android implementation of image_picker.

Usage

This package is endorsed, which means you can simply use image_picker normally. This package will be automatically included in your app when you do, so you do not need to add it to your pubspec.yaml.

However, if you import this package to use any of its APIs directly, you should add it to your pubspec.yaml as usual.

Photo Picker

On Android 16 and above, gallery image, video, and mixed-media picks always use the Android Photo Picker. ImagePickerAndroid.useAndroidPhotoPicker has no effect on those versions.

On Android 15 and below, this package has optional Android Photo Picker functionality. To enable it, add the following code to your app before calling any image_picker APIs:

import 'package:image_picker_android/image_picker_android.dart';
import 'package:image_picker_platform_interface/image_picker_platform_interface.dart';
// ···
  final ImagePickerPlatform imagePickerImplementation = ImagePickerPlatform.instance;
  if (imagePickerImplementation is ImagePickerAndroid) {
    imagePickerImplementation.useAndroidPhotoPicker = true;
  }

In addition, ImagePickerAndroid.useAndroidPhotoPicker must be set to true to use the limit functionality. It is implemented based on ActivityResultContract, so it can only be ensured to take effect on Android 13 or above. Otherwise, it depends on whether the corresponding system app supports it.

Changelog

0.8.13+25

  • Fixes resizing with maxWidth or maxHeight always decoding the full-size image; large images are now subsampled while decoding.

0.8.13+24

  • Updates Robolectric to 4.17 and adds the JVM arguments it requires for unit tests.
  • Updates minimum supported SDK version to Flutter 3.41/Dart 3.11.

0.8.13+23

  • Fixes a crash when the content provider returns no stream for a picked image; the pick now fails with missing_valid_image_uri instead.

0.8.13+22

  • Fixes gallery image/video selection on Android API 36+ returning no paths when useAndroidPhotoPicker was false. The plugin now uses the Android Photo Picker on API 36 and above regardless of that flag.

0.8.13+21

  • Updates pigeon dev_dependency to ^27.3.2 for analyzer 14 compatibility.

0.8.13+20

  • Bumps androidx.activity:activity from 1.12.4 to 1.13.0.

0.8.13+19

  • Bumps the androidx group across 10 directories with 1 update.

0.8.13+18

  • Migrates to Built-in Kotlin to support AGP 9.
  • Updates minimum supported SDK version to Flutter 3.44/Dart 3.12.

0.8.13+17

  • Updates internal implementation to use Kotlin Pigeon.

0.8.13+16

  • Bumps androidx.core:core from 1.17.0 to 1.18.0.

0.8.13+15

  • Updates build files from Groovy to Kotlin.

0.8.13+14

  • Bumps androidx.activity:activity from 1.12.2 to 1.12.4.

0.8.13+13

  • Bumps androidx.activity:activity from 1.11.0 to 1.12.2.

0.8.13+12

  • Bump androidx.core:core from 1.13.1 to 1.17.0.

0.8.13+11

  • Bumps androidx.exifinterface:exifinterface from 1.4.1 to 1.4.2.

0.8.13+10

  • Bumps com.android.tools.build:gradle from 8.12.1 to 8.1.

0.8.13+9

  • Bumps androidx.activity:activity from 1.10.1 to 1.11.0.

0.8.13+8

  • Updates to Pigeon 26.

0.8.13+7

  • Removes reference to internal isSystemPickerAvailable$activity_release() method.

0.8.13+6

  • Fixes typo in limit parameter validation error message.

0.8.13+5

  • Updates Java compatibility version to 17 and minimum supported SDK version to Flutter 3.35/Dart 3.9.

0.8.13+4

  • Resolves Gradle 9 deprecations.

0.8.13+3

  • Bumps androidx.exifinterface:exifinterface from 1.3.7 to 1.4.1.

0.8.13+2

  • Updates minimum supported SDK version to Flutter 3.35.
  • Removes obsolete code related to supporting SDK <24.

0.8.13+1

  • Bumps com.android.tools.build:gradle to 8.12.1.
  • Updates minimum supported SDK version to Flutter 3.29/Dart 3.7.

0.8.13

  • Adds support for getMultiVideoWithOptions.

0.8.12+25

  • Updates kotlin version to 2.2.0 to enable gradle 8.11 support.

0.8.12+24

  • Updates androidx.activity:activity to 1.10.1.

0.8.12+23

  • Removes obsolete code related to supporting SDK <21.

0.8.12+22

  • Updates compileSdk 34 to flutter.compileSdkVersion.

0.8.12+21

  • Ensures that platform messages on background queues are handled in order.

0.8.12+20

  • Updates androidx.annotation:annotation to 1.9.1.

0.8.12+19

  • Updates androidx.activity:activity to 1.9.3.

0.8.12+18

  • Fixes a security issue related to improperly trusting filenames provided by a ContentProvider.

0.8.12+17

  • Bumps androidx.annotation:annotation from 1.8.2 to 1.9.0.

0.8.12+16

  • Updates Pigeon for non-nullable collection type support.

0.8.12+15

  • Updates Java compatibility version to 11.

0.8.12+14

  • Bumps androidx.activity:activity from 1.9.1 to 1.9.2.

0.8.12+13

  • Removes dependency on org.jetbrains.kotlin:kotlin-bom.
  • Updates minimum supported SDK version to Flutter 3.24/Dart 3.5.

0.8.12+12

  • Bumps androidx.annotation:annotation from 1.8.1 to 1.8.2.

0.8.12+11

  • Bumps androidx.annotation:annotation from 1.8.0 to 1.8.1.

0.8.12+10

  • Bumps androidx.activity:activity from 1.9.0 to 1.9.1.

0.8.12+9

  • Bumps androidx.annotation:annotation from 1.7.1 to 1.8.0.

0.8.12+8

  • Updates lint checks to ignore NewerVersionAvailable.

0.8.12+7

  • Bumps androidx.activity:activity from 1.8.2 to 1.9.0.

0.8.12+6

  • Bumps androidx.activity:activity from 1.7.2 to 1.8.2.

0.8.12+5

  • Updates Android Gradle Plugin to 8.5.1.

0.8.12+4

  • Bumps androidx.core:core from 1.10.1 to 1.13.1.

0.8.12+3

  • Update documentation to note that limit is not always supported.

0.8.12+2

  • Updates minimum supported SDK version to Flutter 3.22/Dart 3.4.
  • Removes support for apps using the v1 Android embedding.

0.8.12+1

  • Fixes another app crash case on Android 12+, and refactors getting of paths from intents.

0.8.12

  • Fixes app crashes on Android 12+ caused by selecting images with size 0.

0.8.11

  • Updates documentation to note that Android Photo Picker use is not optional on Android 13+.

0.8.10

  • Adds limit parameter to MediaOptions and MultiImagePickerOptions that sets a limit to how many media or image items can be selected.

0.8.9+6

  • Updates minSdkVersion to 19.
  • Updates minimum supported SDK version to Flutter 3.16/Dart 3.2.

0.8.9+5

  • Bumps androidx.exifinterface:exifinterface from 1.3.6 to 1.3.7.

0.8.9+4

  • Minimizes scope of deprecation warning suppression to only the versions where it is required.
  • Updates minimum supported SDK version to Flutter 3.13/Dart 3.1.
  • Updates compileSdk version to 34.

0.8.9+3

  • Bumps androidx.annotation:annotation from 1.7.0 to 1.7.1.

0.8.9+2

  • Fixes new lint warnings.

0.8.9+1

  • Updates plugin and example Gradle versions to 7.6.3.

0.8.9

  • Fixes resizing bug and updates rounding to be more accurate.
  • Updates minimum supported SDK version to Flutter 3.10/Dart 3.0.

0.8.8+2

  • Updates annotations lib to 1.7.0.

0.8.8+1

  • Fixes NullPointerException on pre-Android 13 devices when using Android Photo Picker to pick image or video.

0.8.8

  • Adds additional category II and III exif tags to be copied during photo resize.

0.8.7+5

  • Adds pub topics to package metadata.
  • Updates minimum supported SDK version to Flutter 3.7/Dart 2.19.

0.8.7+4

  • Updates the example to use the latest versions of the platform interface APIs.

0.8.7+3

  • Bumps androidx.activity:activity from 1.7.1 to 1.7.2.

0.8.7+2

  • Fixes a crash case when picking an image with a display name that does not contain a period.

0.8.7+1

  • Bumps org.jetbrains.kotlin:kotlin-bom from 1.8.21 to 1.8.22.

0.8.7

  • Adds getMedia method.

0.8.6+20

  • Bumps androidx.activity:activity from 1.7.0 to 1.7.1.

0.8.6+19

  • Bumps androidx.core:core from 1.9.0 to 1.10.1.

0.8.6+18

  • Bumps org.jetbrains.kotlin:kotlin-bom from 1.8.10 to 1.8.21.

0.8.6+17

  • Moves disk accesses to background thread.

0.8.6+16

  • Fixes crashes caused by SecurityException when calling getPathFromUri().

0.8.6+15

  • Bumps androidx.activity:activity from 1.6.1 to 1.7.0.

0.8.6+14

  • Fixes Java warnings.

0.8.6+13

  • Fixes BuildContext handling in example.

0.8.6+12

  • Improves image resizing performance by decoding Bitmap only when needed.

0.8.6+11

  • Updates gradle to 7.6.1.
  • Updates gradle, AGP and fixes some lint errors.

0.8.6+10

  • Offloads picker result handling to separate thread.

0.8.6+9

  • Fixes compatibility with AGP versions older than 4.2.

0.8.6+8

  • Adds a namespace for compatibility with AGP 8.0.

0.8.6+7

  • Fixes handling of non-bitmap image types.
  • Updates minimum Flutter version to 3.3.

0.8.6+6

  • Bumps androidx.core:core from 1.8.0 to 1.9.0.

0.8.6+5

  • Fixes case when file extension returned from the OS does not match its real mime type.

0.8.6+4

  • Bumps androidx.exifinterface:exifinterface from 1.3.3 to 1.3.6.

0.8.6+3

  • Switches to Pigeon for internal implementation.

0.8.6+2

  • Fixes null pointer exception in saveResult.

0.8.6+1

  • Refactors code in preparation for adopting Pigeon.

0.8.6

  • Adds usePhotoPickerAndroid options.

0.8.5+10

  • Clarifies explanation of endorsement in README.
  • Aligns Dart and Flutter SDK constraints.

0.8.5+9

  • Fixes compilation warnings.
  • Updates compileSdkVersion to 33.

0.8.5+8

  • Adds Android 13 photo picker functionality if SDK version is at least 33.
  • Bumps compileSdkVersion from 31 to 33

0.8.5+7

  • Updates links for the merge of flutter/plugins into flutter/packages.

0.8.5+6

  • Updates minimum Flutter version to 3.0.
  • Fixes names of picked files to match original filenames where possible.

0.8.5+5

  • Updates code for stricter lint checks.

0.8.5+4

  • Fixes null cast exception when restoring a cancelled selection.

0.8.5+3

  • Updates minimum Flutter version to 2.10.
  • Bumps gradle from 7.1.2 to 7.2.1.

0.8.5+2

  • Updates image_picker_platform_interface constraint to the correct minimum version.

0.8.5+1

  • Switches to an internal method channel implementation.

0.8.5

  • Updates gradle to 7.1.2.

0.8.4+13

  • Minor fixes for new analysis options.

0.8.4+12

  • Fixes library_private_types_in_public_api, sort_child_properties_last and use_key_in_widget_constructors lint warnings.

0.8.4+11

  • Splits from image_picker as a federated implementation.

Installing

export PUB_HOSTED_URL=https://pub.mirror.p-hatan.ir
flutter pub add image_picker_android
pubspec.yaml
name: image_picker_android
description: Android implementation of the image_picker plugin.
repository: https://github.com/flutter/packages/tree/main/packages/image_picker/image_picker_android
issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+image_picker%22
version: 0.8.13+25

environment:
  sdk: ^3.12.0
  flutter: ">=3.44.0"

flutter:
  plugin:
    implements: image_picker
    platforms:
      android:
        package: io.flutter.plugins.imagepicker
        pluginClass: ImagePickerPlugin
        dartPluginClass: ImagePickerAndroid

dependencies:
  flutter:
    sdk: flutter
  flutter_plugin_android_lifecycle: ^2.0.1
  image_picker_platform_interface: ^2.11.0
  meta: ^1.10.0

dev_dependencies:
  flutter_test:
    sdk: flutter
  mockito: ^5.4.4
  pigeon: ^27.3.2

topics:
  - camera
  - image-picker
  - files
  - file-selection

Version history

VersionPublishedArchiveSHA-256
0.8.4+11On demandDownload3ebd6bb2…fca4fe
0.8.4+12On demandDownloadeeea01d2…8286a8
0.8.4+13On demandDownload524c04b8…43a276
0.8.5On demandDownload08cfcbf6…87d651
0.8.5+1On demandDownload2d4c2634…cd853c
0.8.5+2On demandDownload8243d332…67def9
0.8.5+3On demandDownload822f71a5…68648a
0.8.5+4On demandDownloadb2271807…167b82
0.8.5+5On demandDownloadb1cbfec0…3f7368
0.8.5+6On demandDownload385f12ee…d21f1d
0.8.5+7On demandDownload68d067ba…beb344
0.8.5+8On demandDownload845f7938…98cc16
0.8.5+9On demandDownloadca14b663…71225a
0.8.5+10On demandDownload76730007…5fa67a
0.8.6On demandDownload1f5a4b38…2b5101
0.8.6+1On demandDownload420ed22d…1ae669
0.8.6+2On demandDownload9c277637…2ba794
0.8.6+3On demandDownload52a1ac88…e3f6f1
0.8.6+4On demandDownload42b2f33d…19b1d2
0.8.6+5On demandDownloadb81db5f5…da4d4c
0.8.6+6On demandDownloaddfb5b0f2…f212a7
0.8.6+7On demandDownload1ea68703…4f269c
0.8.6+8On demandDownloada07e3c11…8d5fce
0.8.6+9On demandDownload4ffaf537…8d6823
0.8.6+10On demandDownload7d2b25e0…ac68fe
0.8.6+11On demandDownload271e0448…b10da2
0.8.6+12On demandDownloadcc3e183c…f487be
0.8.6+13On demandDownload794f9108…2af51f
0.8.6+14On demandDownload89ba2aa6…5b77ed
0.8.6+15On demandDownload364967c8…f7501c
0.8.6+16On demandDownloadc2f3c664…046e59
0.8.6+17On demandDownload80dd8979…92e59f
0.8.6+18On demandDownloadeda1d53c…ae16af
0.8.6+19On demandDownload3083c3a3…601692
0.8.6+20On demandDownload1ec68302…6b4bd8
0.8.7On demandDownload216dbfb6…a6d922
0.8.7+1On demandDownload0d6d8d04…26d619
0.8.7+2On demandDownload9d5dac72…3657f6
0.8.7+3On demandDownloadd2bab152…a475bb
0.8.7+4On demandDownload8179b540…05ca34
0.8.7+5On demandDownloadd32a997b…a0462d
0.8.8On demandDownload47da2161…9cb369
0.8.8+1On demandDownload0c7b83bb…937ff2
0.8.8+2On demandDownloadd6a6e788…a4957f
0.8.9On demandDownloaddae8aa23…2ada2d
0.8.9+1On demandDownloadecdc963d…a396fe
0.8.9+2On demandDownload1a27bf4c…7759ec
0.8.9+3On demandDownload39f2bfe4…7b51b1
0.8.9+5On demandDownload42c098e7…9f4321
0.8.9+6On demandDownload844c6da4…967a58
0.8.10On demandDownload8e75431a…7c4cb9
0.8.11On demandDownload40e24f46…2398c8
0.8.12On demandDownload79455f6c…b98370
0.8.12+1On demandDownload0f57fee1…1a19f1
0.8.12+2On demandDownloadc01a23e2…81ca33
0.8.12+3On demandDownload4161e1f8…b7b51c
0.8.12+4On demandDownloadff39a10a…2c25db
0.8.12+5On demandDownload9e32a194…71f147
0.8.12+6On demandDownloadcea2bd5b…8eeb7f
0.8.12+7On demandDownloada26dc9a0…a81889
0.8.12+8On demandDownload8c316846…60393e
0.8.12+9On demandDownload1b65687c…b528f9
0.8.12+10On demandDownload3fe99e3a…26ec87
0.8.12+11On demandDownloadc0e72ecd…c5db4b
0.8.12+12On demandDownload8c5abf0d…a70f56
0.8.12+13On demandDownloadc0a6763d…05cc85
0.8.12+14On demandDownloaddbd24fc9…9655bb
0.8.12+15On demandDownloadd3e5e00f…28e643
0.8.12+16On demandDownloadd34e0d9e…065d82
0.8.12+17On demandDownload8faba09b…86bd32
0.8.12+18On demandDownloadfa814160…2c193e
0.8.12+19On demandDownloadaa6f1280…c5e59f
0.8.12+20On demandDownloadb62d34a5…08ee0c
0.8.12+21On demandDownload82652a75…e5e89a
0.8.12+22On demandDownload8bd392ba…f090e9
0.8.12+23On demandDownload317a5d96…b9ebeb
0.8.12+24On demandDownload6fae381e…b80c8d
0.8.12+25On demandDownloadb08e9a04…a7ccd6
0.8.13On demandDownloade83b2b05…60050c
0.8.13+1On demandDownload28f3987c…5cfa6e
0.8.13+2On demandDownloada45bef33…7cdd52
0.8.13+3On demandDownload8dfe08ea…32cd02
0.8.13+4On demandDownloaddd7a61da…cac0dc
0.8.13+5On demandDownload58a85e6f…18efca
0.8.13+7On demandDownloadca2a3b04…0056f6
0.8.13+8On demandDownloada1cd1584…adcabe
0.8.13+9On demandDownload788167bc…a8de40
0.8.13+10On demandDownload5e9bf126…224677
0.8.13+11On demandDownload539e0030…a139d7
0.8.13+12On demandDownload297e42bd…f7e6a1
0.8.13+13On demandDownload518a1610…2e703d
0.8.13+14On demandDownloadeda9b91b…a86156
0.8.13+15On demandDownload9eae0cbd…b0d3fd
0.8.13+16On demandDownload66810af8…8c6622
0.8.13+17On demandDownloadd5b3e177…14793f
0.8.13+18On demandDownload695b6a97…5e36af
0.8.13+19On demandDownload6f3a1995…4df84a
0.8.13+21On demandDownloadf71f4f3a…13b72a
0.8.13+22On demandDownload1c0c3879…81cf54
0.8.13+23On demandDownload0a55d645…1e7219
0.8.13+25Cached · Upstream SHA-256 matchedDownload8a7823d5…a912d4

Dependencies

flutter { "sdk": "flutter" }

flutter_plugin_android_lifecycle "^2.0.1"

image_picker_platform_interface "^2.11.0"

meta "^1.10.0"