MyImagePatterns extension

Adds pattern-matching-related methods to MyImage.

on

Methods

map<TResult extends Object?>({required TResult network(MyNetworkImage value), required TResult base64(MyBase64Image value), required TResult filePath(MyFilePathImage value), required TResult asset(MyAssetImage value)}) → TResult

Available on MyImage, provided by the MyImagePatterns extension

A switch-like method, using callbacks.
mapOrNull<TResult extends Object?>({TResult? network(MyNetworkImage value)?, TResult? base64(MyBase64Image value)?, TResult? filePath(MyFilePathImage value)?, TResult? asset(MyAssetImage value)?}) → TResult?

Available on MyImage, provided by the MyImagePatterns extension

A variant of map that fallback to returning null.
maybeMap<TResult extends Object?>({TResult network(MyNetworkImage value)?, TResult base64(MyBase64Image value)?, TResult filePath(MyFilePathImage value)?, TResult asset(MyAssetImage value)?, required TResult orElse()}) → TResult

Available on MyImage, provided by the MyImagePatterns extension

A variant of map that fallback to returning orElse.
maybeWhen<TResult extends Object?>({TResult network(String url, ImageParams params)?, TResult base64(String base64Code, ImageParams params)?, TResult filePath(String filePath, ImageParams params)?, TResult asset(String assetPath, ImageParams params)?, required TResult orElse()}) → TResult

Available on MyImage, provided by the MyImagePatterns extension

A variant of when that fallback to an orElse callback.
when<TResult extends Object?>({required TResult network(String url, ImageParams params), required TResult base64(String base64Code, ImageParams params), required TResult filePath(String filePath, ImageParams params), required TResult asset(String assetPath, ImageParams params)}) → TResult

Available on MyImage, provided by the MyImagePatterns extension

A switch-like method, using callbacks.
whenOrNull<TResult extends Object?>({TResult? network(String url, ImageParams params)?, TResult? base64(String base64Code, ImageParams params)?, TResult? filePath(String filePath, ImageParams params)?, TResult? asset(String assetPath, ImageParams params)?}) → TResult?

Available on MyImage, provided by the MyImagePatterns extension

A variant of when that fallback to returning null