Java2Dart Resource Leak

 Java developers need to use try finally clause in order to prevent resources leak.


 try (BufferedReader br =
                   new BufferedReader(new FileReader(path))) {
        return br.readLine();

Prior to Java SE 7 the code looked like

BufferedReader br = null;
br =  new BufferedReader(new FileReader(path))
} finally{
	if (br == null) {

The following code will guaranty that br.close(), will be called when the try block is over.

DART too has resources which needs to be closed, in order to prevent leaks. For example, here and basically most of the dart:io library  requires calling close().
However the DART language does not support syntax which eliminates the finally pitfall.


  OutputStream out = null;
    try {
      out =  new File("c:\\log.txt").openOutputStream(FileMode.WRITE);
      out.writeString("FILE ACCESSED ${new}");
    } finally{
      if (out != null){