decorationImage static method

Map<String, dynamic>? decorationImage(
  1. DecorationImage? image
)

Returns a DecorationImage from the specified map.

The DecorationImage.image is determined by interpreting the same key as per imageProvider. If that method returns null, then this returns null also. Otherwise, the return value is used as the provider and additional keys map to the identically-named properties of DecorationImage: onError (must be an event handler; the payload map is augmented by an exception key that contains the text serialization of the exception and a stackTrace key that contains the stack trace, also as a string), colorFilter (colorFilter), fit (enumValue of BoxFit), alignment (alignment, defaults to Alignment.center), centerSlice (rect), repeat (enumValue of ImageRepeat, defaults to ImageRepeat.noRepeat), matchTextDirection (boolean, defaults to false).

Implementation

static Map<String, dynamic>? decorationImage(DecorationImage? image) {
  if (image == null) return null;
  final provider = imageProvider(image.image);
  return NotNullMap.from({
    ...?provider,
    // TODO: still not sure about this
    // 'onError': DataSourceEncoder.voidHandler(image.onError),
    'colorFilter': colorFilter(image.colorFilter),
    'fit': enumValue<BoxFit>(image.fit),
    'alignment': alignment(image.alignment),
    'centerSlice': rect(image.centerSlice),
    'repeat': enumValue<ImageRepeat>(image.repeat),
    'matchTextDirection': image.matchTextDirection,
    'scale': image.scale,
    'opacity': image.opacity,
    'filterQuality': enumValue<FilterQuality>(image.filterQuality),
    'invertColors': image.invertColors,
    'isAntiAlias': image.isAntiAlias,
  });
}