简体   繁体   English

base64.encode未编码整个文件,缺少零件文件编码Flutter Dart错误

[英]base64.encode Not Encoding The whole File , Missing Parts file Encoding Flutter Dart ERROR

i am using following code to encode PDF file to base 64 我正在使用以下代码将PDF文件编码为base 64

                File f = new File(_path);
//              String base64pdf = base64Encode(f.readAsBytesSync());
                String base64pdf = base64.encode(f.readAsBytesSync());
                String fileName = _fileName;
                print('base64pdf: '+base64pdf);

I tried to encode the pdf file on here: encoding website 我尝试在此处编码 pdf文件: 编码网站
the result from the website shows that the base64 encoder inside flutter(dart) is trimming a big section of the String Generated and give only little first part of it ? 该网站的结果显示,flutter(dart)中的base64编码器正在修整String Generated的很大一部分,而只给出了很少的第一部分?
how to solve that , is this related with byte type? 如何解决,这和字节类型有关吗?

RaisedButton(
 onPressed: () async {
 List<int> imageBytes = await sampleImage.readAsBytes();
 base64Image =  base64Encode(imageBytes);
 print(base64Image);},),


SizedBox(height: 30,),


Image.memory(base64Decode(base64Image)),

Base 64 code in my git hub repo 我的git hub回购中的Base 64代码

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM