OneFrameImageStreamCompleter constructor

OneFrameImageStreamCompleter(Future<ImageInfo> image, { InformationCollector informationCollector })

Creates a manager for one-frame ImageStreams.

The image resource awaits the given Future. When the future resolves, it notifies the ImageListeners that have been registered with addListener.

The InformationCollector, if provided, is invoked if the given Future resolves with an error, and can be used to supplement the reported error message (for example, giving the image's URL).

Errors are reported using FlutterError.reportError with the silent argument on FlutterErrorDetails set to true, meaning that by default the message is only dumped to the console in debug mode (see new FlutterErrorDetails).

Implementation

OneFrameImageStreamCompleter(Future<ImageInfo> image, { InformationCollector informationCollector })
  : assert(image != null) {
  image.then<void>(setImage, onError: (dynamic error, StackTrace stack) {
    reportError(
      context: 'resolving a single-frame image stream',
      exception: error,
      stack: stack,
      informationCollector: informationCollector,
      silent: true,
    );
  });
}