Using Dart to Download a PNG File (Binary File) and displaying it not working

后端 未结 1 1481
轮回少年
轮回少年 2021-01-14 23:05

I have a rest API which I am calling to retrieve a PNG image to display on my page.

My Code:

void getProfile         


        
1条回答
  •  -上瘾入骨i
    2021-01-14 23:31

    The problem is this line:

    Blob blob = new Blob(request.response);
    

    The Blob constructor expects a List instead of another Blob (which request.response is in your use case): factory Blob(List blobParts, [String type, String endings])

    Just delete the line, and directly call reader.readAsDataUrl(request.response), and it should work.

    0 讨论(0)
提交回复
热议问题