Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

How to remove first part of string so I can decode it. flutter/dart

I’m getting bytes property from api as a string but it has prefix and it looks like this:
data:application/octet-stream;base64,JVBERi0xLjcNJeLjz9MNCjEgMCBvYmoNPDwv.... So my question is how can i remove this part data:application/octet-stream;base64, from string so I can decode the rest of same string.

>Solution :

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

Another way to do it is like:

final str = "data:application/octet-stream;base64,JVBERi0xLjcNJeLjz9MNCjEgMCBvYmoNPDwv0w";
final desiredStr = str.substring(str.indexOf(',') + 1);
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading