photo_manager 0.2.0

  • Example
  • Installing
  • Versions
  • 91

photo_manager #

pub package GitHub GitHub stars

A flutter api for photo, you can get image/video from ios or android

一个提供相册 api 的插件, android ios 可用,没有 ui,以便于自定义自己的界面, 你可以通过提供的 api 来制作图片相关的 ui 或插件

or use photo library , a multi image picker .All UI comes from flutter.

api changed #

in 0.1.0 API incompatibility

because support video, so rename api from ImageXXXX to AssetXXXX

so 0.1.X and 0.0.X incompatibility

install #

  photo_manager: ^0.2.0

import #

import 'package:photo_manager/photo_manager.dart';

use #

see the example/lib/main.dart

or see next

example #

  1. request permission

You must get the user's permission on android/ios.

var result = await PhotoManager.requestPermission();
if (result) {
    // success
} else {
    // fail
    // if result is fail, you can call PhotoManger.openSetting();  to open android/ios applicaton's setting to get permission
  1. you get all of asset list (gallery)
List<AssetPathEntity> list = await PhotoManager.getAssetPathList();
  1. get asset list from imagePath
List<AssetEntity> imageList = await data.assetList;
  1. use the AssetEntity
AssetEntity entity = imageList[0];

File file = await entity.file; // image file

List<int> fileData = await entity.fullData; // image/video file bytes

Uint8List thumbBytes = await entity.thumbData; // thumb data ,you can use Image.memory(thumbBytes); size is 64px*64px;

Uint8List thumbDataWithSize = await entity.thumbDataWithSize(width,height); //Just like thumbnails, you can specify your own size. unit is px;

AssetType type = entity.type; // the type of asset enum of other,image,video

Duration duration = await entity.duration; //if type is not video, then return null.

about ios build error #

if your flutter print like the log. see so

Xcode's output:
    The use of Swift 3 @objc inference in Swift 4 mode is deprecated. Please address deprecated @objc inference warnings, test your code with “Use of deprecated Swift 3 @objc inference” logging enabled, and then disable inference by changing the "Swift 3 @objc Inference" build setting to "Default" for the "Runner" target.
    While building module 'photo_manager' imported from /Users/cai/IdeaProjects/flutter/sxw_order/ios/Runner/GeneratedPluginRegistrant.m:9:
    In file included from <module-includes>:1:
    In file included from /Users/cai/IdeaProjects/flutter/sxw_order/build/ios/Debug-iphonesimulator/photo_manager/photo_manager.framework/Headers/photo_manager-umbrella.h:16:
    /Users/cai/IdeaProjects/flutter/sxw_order/build/ios/Debug-iphonesimulator/photo_manager/photo_manager.framework/Headers/MD5Utils.h:5:9: error: include of non-modular header inside framework module 'photo_manager.MD5Utils': '/Applications/' [-Werror,-Wnon-modular-include-in-framework-module]
    #import <CommonCrypto/CommonDigest.h>
    1 error generated.
    /Users/cai/IdeaProjects/flutter/sxw_order/ios/Runner/GeneratedPluginRegistrant.m:9:9: fatal error: could not build module 'photo_manager'
    #import <photo_manager/ImageScannerPlugin.h>
    2 errors generated.

about ios #

Because the album is a privacy privilege, you need user permission to access it. You must to modify the Info.plist file in Runner project.

like next

    <string>App need your agree, can visit your album</string>

xcode like image in xcode


0.2.0 #

add asset size field

release cache method

0.1.10 #


when number of photo/video is 0, will crash

0.1.9 #

add video duration

0.1.8 sort asset by data #

0.1.7 fix bug #

fix bug: Android's latest picture won't be found

update gradle wrapper version.

update kotlin version

0.1.6 #

Fix Android to get pictures that are empty bug.

0.1.5 #

support ios icloud image and video

0.1.4 fix bug #

update all path hasVideo property

0.1.3 add params #

add a params to help user disable get video

0.1.2 fix bug #

ios get video file is async

0.1.1 fix ios video #

fix 'ios video full file is a jpg' problem

0.1.0 support video #

support video in android. and will change api from ImageXXXX to AssetXXXX

0.0.3 fix bug #

update for the issue #1 (NPE when request other permission on android)

0.0.2 update readme #

0.0.1 #

first version

api for photo


image_scanner_example #

Demonstrates how to use the image_scanner plugin.

Getting Started #

For help getting started with Flutter, view our online documentation.

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:

  photo_manager: ^0.2.0

2. Install it

You can install packages from the command line:

with Flutter:

$ flutter packages get

Alternatively, your editor might support flutter packages get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:

import 'package:photo_manager/photo_manager.dart';
Version Uploaded Documentation Archive
0.2.0 Feb 15, 2019 Go to the documentation of photo_manager 0.2.0 Download photo_manager 0.2.0 archive
0.1.10 Dec 31, 2018 Go to the documentation of photo_manager 0.1.10 Download photo_manager 0.1.10 archive
0.1.9 Dec 28, 2018 Go to the documentation of photo_manager 0.1.9 Download photo_manager 0.1.9 archive
0.1.8 Dec 26, 2018 Go to the documentation of photo_manager 0.1.8 Download photo_manager 0.1.8 archive
0.1.7 Dec 12, 2018 Go to the documentation of photo_manager 0.1.7 Download photo_manager 0.1.7 archive
0.1.6 Nov 7, 2018 Go to the documentation of photo_manager 0.1.6 Download photo_manager 0.1.6 archive
0.1.5 Nov 3, 2018 Go to the documentation of photo_manager 0.1.5 Download photo_manager 0.1.5 archive
0.1.4 Oct 17, 2018 Go to the documentation of photo_manager 0.1.4 Download photo_manager 0.1.4 archive
0.1.3 Oct 12, 2018 Go to the documentation of photo_manager 0.1.3 Download photo_manager 0.1.3 archive
0.1.2 Oct 12, 2018 Go to the documentation of photo_manager 0.1.2 Download photo_manager 0.1.2 archive

All 15 versions...

Describes how popular the package is relative to other packages. [more]
Code health derived from static analysis. [more]
Reflects how tidy and up-to-date the package is. [more]
Weighted score of the above. [more]
Learn more about scoring.

We analyzed this package on Feb 15, 2019, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.1.0
  • pana: 0.12.13
  • Flutter: 1.2.0


Detected platforms: Flutter

References Flutter, and has no conflicting libraries.

Health suggestions

Fix lib/photo_manager.dart. (-0.50 points)

Analysis of lib/photo_manager.dart reported 1 hint:

line 202 col 23: The method '_isCloudWithAsset' isn't used.


Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.0.0-dev.28.0 <3.0.0
flutter 0.0.0
Transitive dependencies
collection 1.14.11
meta 1.1.6 1.1.7
sky_engine 0.0.99
typed_data 1.1.6
vector_math 2.0.8