photo_manager 0.1.5 photo_manager: ^0.1.5 copied to clipboard
You can scan photos and albums. Only api, not have ui. you can use the api to create your image picker. or use photo
photo_manager #
A flutter api for photo, you can get image/video from ios or android,support icloud image.
一个提供相册 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 #
dependencies:
photo_manager: ^0.1.5
import #
import 'package:photo_manager/photo_manager.dart';
use #
see the example/lib/main.dart
or see next
example #
- you must requestPermission
var result = await PhotoManager.requestPermission();
if(result == true){
// success
}else{
// fail
}
- you get all of asset list(gallery)
List<AssetPathEntity> list = await PhotoManager.getAssetPathList();
- get asset list from imagePath
List<AssetEntity> imageList = await data.assetList;
- 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