MultiFrameImageStreamCompleter constructor

MultiFrameImageStreamCompleter({@required Future<Codec> codec, @required double scale, InformationCollector informationCollector })

Creates a image stream completer.

Immediately starts decoding the first image frame when the codec is ready.

codec is a future for an initialized ui.Codec that will be used to decode the image. scale is the linear scale factor for drawing this frames of this image at their intended size.

Implementation

MultiFrameImageStreamCompleter({
  @required Future<ui.Codec> codec,
  @required double scale,
  InformationCollector informationCollector
}) : assert(codec != null),
     _informationCollector = informationCollector,
     _scale = scale,
     _framesEmitted = 0,
     _timer = null {
  codec.then<void>(_handleCodecReady, onError: (dynamic error, StackTrace stack) {
    reportError(
      context: 'resolving an image codec',
      exception: error,
      stack: stack,
      informationCollector: informationCollector,
      silent: true,
    );
  });
}