-
Notifications
You must be signed in to change notification settings - Fork 32
Implement iterable
on types where it's defined
#21
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
To make this more concrete, there are https://github.com/w3c/webref/blob/75015f219dc2fede4af8c953d93b1517c1691204/ed/idl/dom.idl#L158 that should expose |
I checked and the for (const file of fileInput.files) {
output.innerText += `\n${file.name}`;
} It'd be nice if there was some way of wrapping those "things that have PS, I added this: /// Adds a `toList` method to [web.FileList] objects.
extension WebFileListToDartList on web.FileList {
/// Converts a [web.FileList] into a [List] of [web.File].
///
/// This method makes a copy.
List<web.File> get toList =>
<web.File>[for (int i = 0; i < length; i++) item(i)!];
} |
There's a similar issue here: #91 (see point b). I think going the route of adding a extension on JSObject {
/// Wraps this object with an [Iterable] implementation whose
/// methods forward to the object.
external Iterable<T> toDartIterable<T extends JSAny?>();
} These types don't really have a supertype in JS that groups them in some kind of "list-like" category, so there isn't a concrete separation from I don't want to expose APIs that copy over the values into a Dart list as it's more expensive and users likely iterate over the list only once. |
Not sure if this in on your radar or not, @joshualitt
The text was updated successfully, but these errors were encountered: