OneFramePictureStreamCompleter constructor

OneFramePictureStreamCompleter(
  1. Future<PictureInfo?> picture, {
  2. InformationCollector? informationCollector,
})

Creates a manager for one-frame PictureStreams.

The image resource awaits the given Future. When the future resolves, it notifies the PictureListeners 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 FlutterErrorDetails).

Implementation

OneFramePictureStreamCompleter(
  Future<PictureInfo?> picture, {
  InformationCollector? informationCollector,
  // ignore: unnecessary_null_comparison
}) : assert(picture != null) {
  picture.then<void>(setPicture, onError: (Object error, StackTrace stack) {
    FlutterError.reportError(FlutterErrorDetails(
      exception: error,
      stack: stack,
      library: 'SVG',
      context: ErrorDescription('resolving a single-frame picture stream'),
      informationCollector: informationCollector,
      silent: true,
    ));
  });
}