Note that there are some explanatory texts on larger screens.

plurals
  1. POHow do you open a file chooser in a chrome packaged app with Dart
    primarykey
    data
    text
    <p>There don't appear to be any dart packages for this, so I'm using Javascript interop. This is what I've got so far:</p> <pre class="lang-dart prettyprint-override"><code> js.scoped(() { done(entry) { print('ok'); } js.context.doneCallback = new js.Callback.once(done); js.context.chrome.fileSystem.chooseEntry(null, js.context.doneCallback); }); </code></pre> <p>It's failing with:</p> <blockquote> <p>Uncaught Error: Invocation of form fileSystem.chooseEntry(object, object) doesn't match definition fileSystem.chooseEntry(optional object options, function callback)</p> </blockquote> <p>So it seems the callback is being rejected because it's the wrong type.</p> <p>Any ideas?</p> <p><a href="http://developer.chrome.com/apps/fileSystem.html" rel="nofollow">chrome.fileSystem docs</a> Edit: Changed optional param back to null (I also tried Damien's suggestion below).</p> <p>Edit: this code works now - thanks Damien!</p> <pre class="lang-dart prettyprint-override"><code> js.scoped(() { done(entry) { print('ok'); } js.context.chrome.fileSystem.chooseEntry(null, new js.Callback.once(done)); }); </code></pre> <p>Edit2: <a href="https://gist.github.com/xxgreg/5428315" rel="nofollow">Updated code</a> which opens a file chooser and reads the path from it. However I'm not sure how to use a javascript FileReader object via js_interop.</p> <p>Edit3: See <a href="https://groups.google.com/a/dartlang.org/d/msg/misc/D5hb02teYCU/ZbFLwqnESvYJ" rel="nofollow">discussion</a> on the Dart mailing list.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload