Using resumable.js from Dart


I am trying to use resumable.js from Dart with this code:

var rs = new JS.JsObject(JS.context['Resumable'], [new JS.JsObject.jsify({

files.forEach((file) {

files variable is defined as List<File> (dart.html.File). When I check properties of rs object with these two lines:


I find that rs.opts are initialized correctly, but rs.files always contains instances of ResumableFile with length 1. I guess that it is because method addFile expects parameter to be instance of Javascript File but it gets instanceof dart:html.File.

Do you have any idea how to convert dart:html.File to Javascript File or how to pass argument to resumable.js?

I know that I can alternatively use methods assignBrowse and assignDrop, but I would like to stick to my solution.


You have to use JsObject.fromBrowserObject to get the underlying js object.

files.forEach((file) {
  rs.callMethod("addFile",[new JsObject.fromBrowserObject(file)]);

Answered By – Alexandre Ardhuin

Answer Checked By – Candace Johnson (FlutterFixes Volunteer)

Leave a Reply

Your email address will not be published. Required fields are marked *