loadSegmentImage function

Future<Image> loadSegmentImage(
  1. WheelSegment segment, {
  2. ImageConfiguration configuration = ImageConfiguration.empty,
})

Loads the icon of a single segment.

The caller owns the returned image and must dispose it when done. Throws if the segment has no image source or the image fails to load.

Implementation

Future<ui.Image> loadSegmentImage(
  WheelSegment segment, {
  ImageConfiguration configuration = ImageConfiguration.empty,
}) {
  final ImageProvider? provider = imageProviderFor(segment);
  if (provider == null) {
    throw ArgumentError('Segment "${segment.label}" has no image to load');
  }
  return loadImageFromProvider(provider, configuration: configuration);
}