Skip to content

DDC - DataTransferItem.getAsEntry returns 'NativeJavaScriptObject' instead of 'Entry' #35510

Closed
@Loonacy

Description

@Loonacy
  • Dart SDK Version 2.1.0
  • Windows
  • Chrome

When compiled with web serve, it throws an exception that says "Type 'NativeJavaScriptObject' is not a subtype of expected type 'Entry'."
When compiled with dart2js it works as expected.

Here's a sample of the code i'm using:

void main() {
	fileDivElement.onDrop.listen(_onFilesDrop);
}

void _onFilesDrop(MouseEvent event) async {
	event.stopPropagation();
	event.preventDefault();
	List<Entry> items = List<Entry>();
	for(int i=0; i<event.dataTransfer.items.length; i++) {
// ------------------- This is where it dies --------------------- //
		items.add(event.dataTransfer.items[i].getAsEntry()); 
	}
	_processFiles(items);
}

Metadata

Metadata

Assignees

Labels

area-core-librarySDK core library issues (core, async, ...); use area-vm or area-web for platform specific libraries.library-html

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions