downloadBlob static method

Future<void> downloadBlob(
  1. String name,
  2. Uint8List bytes
)

Downloads the provided bytes as a blob file.

Implementation

static Future<void> downloadBlob(String name, Uint8List bytes) async {
  final JSPromise promise = _webSaveAs(
    web.Blob(
      [bytes.toJS].toJS,
      web.BlobPropertyBag(type: 'text/plain;charset=utf-8'),
    ),
    name.toJS,
  );

  await promise.toDart;
}