call method

  1. @override
Object? call(
  1. Interpreter interpreter,
  2. List<Object?> arguments,
  3. Map<Symbol, Object?> namedArguments
)
override

Implementation

@override
Object? call(Interpreter interpreter, List<Object?> arguments,
    Map<Symbol, Object?> namedArguments) {
  var label = namedArguments[const Symbol('label')];
  if (label == null) {
    throw "label required in SnackBarAction";
  }
  var onPressed = namedArguments[const Symbol('onPressed')];
  if (onPressed == null) {
    throw "onPressed required in SnackBarAction";
  }
  Color? textColor;
  var textColorParsed = namedArguments[const Symbol('textColor')];
  if (textColorParsed != null) {
    textColor = textColorParsed as Color;
  }
  Color? disabledTextColor;
  var disabledTextColorParsed =
      namedArguments[const Symbol('disabledTextColor')];
  if (disabledTextColorParsed != null) {
    disabledTextColor = disabledTextColorParsed as Color;
  }
  return SnackBarAction(
    label: label as String,
    textColor: textColor,
    disabledTextColor: disabledTextColor,
    onPressed: () {
      (onPressed as LoxFunction).call(interpreter, [], {});
    },
  );
}