getPhoto method

Future<String> getPhoto(
  1. String assetsId
)

传入相册的资产ID返回图片或者视频的base64 成功: base64值 失败:请传入正确并存在AssetEntity类型id

Implementation

Future<String> getPhoto (String assetsId) async {
  try {
    var strAssetsId = assetsId.toString();
    var asset = await AssetEntity.fromId(strAssetsId);
    File? file= await asset!.file;
    List<int> fileCode = await file!.readAsBytes();
    var base64 = await base64Encode(fileCode);
    return base64;
  } catch (e) {
    return "请传入正确并存在AssetEntity类型id";
  }
}