call method
Implementation
@override
Object? call(Interpreter interpreter, List<Object?> arguments,
Map<Symbol, Object?> namedArguments) {
var content = namedArguments[const Symbol('content')];
if (content == null) {
throw "content required in SnackBar";
}
Color? backgroundColor;
var backgroundColorParsed = namedArguments[const Symbol('backgroundColor')];
if (backgroundColorParsed != null) {
backgroundColor = backgroundColorParsed as Color;
}
double? elevation = parseDouble(namedArguments[const Symbol('elevation')]);
double? width = parseDouble(namedArguments[const Symbol('width')]);
SnackBarBehavior? snackBarBehavior;
var snackBarBehaviorParsed = namedArguments[const Symbol('behavior')];
if (snackBarBehaviorParsed != null) {
snackBarBehavior = snackBarBehaviorParsed as SnackBarBehavior;
}
EdgeInsetsGeometry? padding;
var paddingParsed = namedArguments[const Symbol('padding')];
if (paddingParsed != null) {
padding = paddingParsed as EdgeInsetsGeometry;
}
EdgeInsetsGeometry? margin;
var marginParsed = namedArguments[const Symbol('margin')];
if (marginParsed != null) {
margin = marginParsed as EdgeInsetsGeometry;
}
ShapeBorder? shape;
var shapeParsed = namedArguments[const Symbol('shape')];
if (shapeParsed != null) {
shape = shapeParsed as ShapeBorder;
}
SnackBarAction? action;
var actionParsed = namedArguments[const Symbol('action')];
if (actionParsed != null) {
action = actionParsed as SnackBarAction;
}
DismissDirection dismissDirection = DismissDirection.down;
var dismissDirectionParsed =
namedArguments[const Symbol('dismissDirection')];
if (dismissDirectionParsed != null) {
dismissDirection = dismissDirectionParsed as DismissDirection;
}
Duration duration = const Duration(milliseconds: 4000);
var durationParsed = namedArguments[const Symbol('duration')];
if (durationParsed != null) {
duration = durationParsed as Duration;
}
return SnackBar(
content: content as Widget,
elevation: elevation,
width: width,
shape: shape,
margin: margin,
duration: duration,
padding: padding,
behavior: snackBarBehavior,
backgroundColor: backgroundColor,
action: action,
dismissDirection: dismissDirection,
);
}