Dart Documentationchrome.src.filesCrDirectoryReader

CrDirectoryReader class

class CrDirectoryReader extends ChromeObject implements DirectoryReader {
 CrDirectoryReader.fromProxy(JsObject jsProxy) : super.fromProxy(jsProxy);

 /**
  * Return a list of child entries for this directory.
  */
 Future<List<Entry>> readEntries() {
   Completer<List<Entry>> completer = new Completer();

   List<Entry> entries = [];

   Function entriesCallback = null;
   Function errorCallback = (var domError) {
     completer.completeError(domError);
   };

   entriesCallback = (/*Entry[]*/ result) {
     if (result['length'] == 0) {
       completer.complete(entries);
     } else {
       entries.addAll(listify(result).map((e) => new CrEntry.fromProxy(e)));
       jsProxy.callMethod('readEntries', [entriesCallback, errorCallback]);
     }
   };

   jsProxy.callMethod('readEntries', [entriesCallback, errorCallback]);

   return completer.future;
 }
}

Extends

ChromeObject > CrDirectoryReader

Implements

DirectoryReader

Constructors

new CrDirectoryReader.fromProxy(JsObject jsProxy) #

Create a new instance of a ChromeObject, which delegates to the given JsObject proxy.

docs inherited from ChromeObject
CrDirectoryReader.fromProxy(JsObject jsProxy) : super.fromProxy(jsProxy);

Properties

final jsProxy #

inherited from ChromeObject
final dynamic jsProxy

Methods

Future<List<Entry>> readEntries() #

Return a list of child entries for this directory.

Future<List<Entry>> readEntries() {
 Completer<List<Entry>> completer = new Completer();

 List<Entry> entries = [];

 Function entriesCallback = null;
 Function errorCallback = (var domError) {
   completer.completeError(domError);
 };

 entriesCallback = (/*Entry[]*/ result) {
   if (result['length'] == 0) {
     completer.complete(entries);
   } else {
     entries.addAll(listify(result).map((e) => new CrEntry.fromProxy(e)));
     jsProxy.callMethod('readEntries', [entriesCallback, errorCallback]);
   }
 };

 jsProxy.callMethod('readEntries', [entriesCallback, errorCallback]);

 return completer.future;
}

JsObject toJs() #

inherited from ChromeObject
JsObject toJs() => jsProxy;

String toString() #

inherited from ChromeObject

Returns a string representation of this object.

docs inherited from Object
String toString() => jsProxy.toString();