MultiFrameImageStreamCompleter constructor
- required Future<
Codec> codec, - required double scale,
- String? debugLabel,
- Stream<
ImageChunkEvent> ? chunkEvents, - InformationCollector? informationCollector,
Creates a image stream completer.
Immediately starts decoding the first image frame when the codec is ready.
The codec
parameter is a future for an initialized ui.Codec that will
be used to decode the image.
The scale
parameter is the linear scale factor for drawing this frames
of this image at their intended size.
The tag
parameter is passed on to created ImageInfo objects to
help identify the source of the image.
The chunkEvents
parameter is an optional stream of notifications about
the loading progress of the image. If this stream is provided, the events
produced by the stream will be delivered to registered ImageChunkListeners
(see addListener).
Implementation
MultiFrameImageStreamCompleter({
required Future<ui.Codec> codec,
required double scale,
String? debugLabel,
Stream<ImageChunkEvent>? chunkEvents,
InformationCollector? informationCollector,
}) : _informationCollector = informationCollector,
_scale = scale {
this.debugLabel = debugLabel;
codec.then<void>(_handleCodecReady, onError: (Object error, StackTrace stack) {
reportError(
context: ErrorDescription('resolving an image codec'),
exception: error,
stack: stack,
informationCollector: informationCollector,
silent: true,
);
});
if (chunkEvents != null) {
_chunkSubscription = chunkEvents.listen(reportImageChunkEvent,
onError: (Object error, StackTrace stack) {
reportError(
context: ErrorDescription('loading an image'),
exception: error,
stack: stack,
informationCollector: informationCollector,
silent: true,
);
},
);
}
}