onReadFileRequested property

EventStream<OnReadFileRequestedEvent> get onReadFileRequested

Raised when reading contents of a file opened previously with openRequestId is requested. The results must be returned in chunks by calling successCallback several times. In case of an error, errorCallback must be called.

Implementation

EventStream<OnReadFileRequestedEvent> get onReadFileRequested =>
    $js.chrome.fileSystemProvider.onReadFileRequested.asStream(($c) => (
          $js.ReadFileRequestedOptions options,
          $js.FileDataCallback successCallback,
          $js.ProviderErrorCallback errorCallback,
        ) {
          return $c(OnReadFileRequestedEvent(
            options: ReadFileRequestedOptions.fromJS(options),
            successCallback: (ByteBuffer data, bool hasMore) {
              //ignore: avoid_dynamic_calls
              (successCallback as Function)(data.toJS, hasMore);
            },
            errorCallback: (ProviderError error) {
              //ignore: avoid_dynamic_calls
              (errorCallback as Function)(error.toJS);
            },
          ));
        });