This code is (mostly) correct w/ the completer. Another, equally valid way to do it is:

    return root.createFile(path).then((chrome.ChromeFileEntry entry) {
      return entry.writeText(content).then((_) => entry);
    });

So, you return the future from createFile(). You also chain some work off it, to write text to the result. You chain work off _that_ one, and return the created entry.