1

do anyone know what is wrong on this code?

FileReader reader = new FileReader();
reader.on.loadEnd.add(fileLoader); 

Error: Breaking on exception: Class 'Events' has no instance getter 'loadEnd'.

Günter Zöchbauer
  • 623,577
  • 216
  • 2,003
  • 1,567
John
  • 2,494
  • 5
  • 21
  • 24

1 Answers1

3

it should be like

reader.onLoadEnd.listen(fileLoader); 
// or reader.onLoadEnd.listen((e) => fileLoader(e)); // don't know what your fileLoader is exactly

or alternatively

reader.on['load-end'].listen(fileLoader);
Günter Zöchbauer
  • 623,577
  • 216
  • 2,003
  • 1,567
  • Thanks for your answer, I looked at examples: http://c.dart-examples.com/api/dart-html/interface/eventtarget/filereader but there are invalid examples I'm afraid. Anyway your examples will not threw any error, but it still does not work I'm afraid and event in loadEnd never happen in my project :-( – John Mar 29 '14 at 08:34
  • I don't think this is an official Dart site. The syntax has changed about a year ago. If something doesn't work as expected you can Ctrl+click on a class or method to jump to its definition and verify what it returns and read the code comments to learn more. If you use DartEditor it should show you where the error is. – Günter Zöchbauer Mar 29 '14 at 08:42