There is already a Previous question about it, but it's obsolete. I haven't found any help from dartlang's site or googling around, so here is again the problem.
document.onPaste.listen((e) {
//var items = e.clipboardData.getData("image");
var blob = e.clipboardData.items.item(0).getAsFile();
var reader = new FileReader();
reader.onLoad.listen((e) {
var img = new ImageElement()
..src = (e.target as FileReader).result;
img.onLoad.listen((_) {
mainContext.drawImage(img, 0, 0);
});
});
reader.readAsDataUrl(blob);
});
The "items" was a previous test, while "blob" shouldn't work, because google removed item(). I haven't found any other way to do that. Last possible solution is to look for a javascript library to do that. Note that I'm using the onPaste even on the whole document because on the canvas it wasn't working, at least for me.