什么是Base64
- 图片转base64
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);
});
- base64显示为图片
str= str.split(',')[1];
Uint8List bytes = Base64Decoder().convert(str);
Image.memory(bytes)