maskFilter static method
Returns a MaskFilter from the specified map.
The type key specifies the kind of mask filter.
A type of blur creates a MaskFilter.blur. The style key (enumValue of
BlurStyle, defaults to BlurStyle.normal) is used as the blur style,
and the sigma key (double, defaults to 1.0) is used as the blur sigma.
If the type is none of these, but is not null, then the type is looked up
in maskFilterDecoders, and if an entry is found, this method defers to
that callback.
Otherwise, returns null.
Implementation
static Map<String, dynamic>? maskFilter(MaskFilter? filter) {
if (filter == null) return null;
String type = filter.toString();
if (type.startsWith('MaskFilter.blur(')) {
List<String> parts = type.split(', ');
return {
'type': 'blur',
'style': parts[0],
'sigma': parts[1],
};
} else {
final encoder = maskFilterEncoders[filter.runtimeType];
if (encoder != null) {
return encoder(filter);
}
return null;
}
}