image_picker_android 0.8.13+22 copy "image_picker_android: ^0.8.13+22" to clipboard
image_picker_android: ^0.8.13+22 copied to clipboard

PlatformAndroid

Android implementation of the image_picker plugin.

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.