There is already a previous question about this, but it is out of date. I did not find any help from the dartlang or googling site, so here again the problem.
document.onPaste.listen((e) {
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);
});
"Elements" was the previous test, and "blob" should not work because google deleted item (). I have not found another way to do this. The last possible solution is to look for a javascript library for this. Please note that I use onPaste even for the entire document, because it did not work on the canvas, at least for me.
source
share