flutter图片转base64【转】

void getImageByGallery(index)async{

ImagePicker.pickImage(source: ImageSource.gallery).then((value)async{

List bytes =await value.readAsBytes();

String bs64 = base64Encode(bytes);

String bs64Image ="data:image/png;base64,"+bs64;

print(bs64Image);

});

来源:https://www.jianshu.com/p/c0cd1b521b20

posted @ 2020-09-01 18:03  小猿笔记  阅读(1823)  评论(0编辑  收藏  举报