Open
Description
Currently, there is no easy way to pass a List<int>/Uint8List
to the Blob
constructor.
We have to do stuff like:
final List<int> bytes = ...;
final Blob blob = Blob(bytes.map((int byte) => byte.toJS).toList().toJS);
Per https://developer.mozilla.org/en-US/docs/Web/API/Blob/Blob#array the constructor's field for the array supports TypedArray
.
There is also no extension to convert a List<int>
(which Uint8List implements) to a JSArray
, since we only have that for List<JSAny?>
. But int
is a primitive that is allowed.
I propose we do either of (or both?)
a) add an extension that converts a List<int>
to a JSArray
b) update the Blob constructor to also allow a JSTypedArray
Personally I would just add option a, since it is easy and we don't need to change the Blob constructor.
Context: flutter/flutter#137374
Metadata
Metadata
Assignees
Labels
No labels