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 date = namedArguments[const Symbol('date')];
  if (date == null) {
    throw "date required in DatePicker";
  }
  var onDateChanged = namedArguments[const Symbol('onDateChanged')];
  if (onDateChanged == null) {
    throw "onDateChange required in DatePicker";
  }
  bool autoHide = true;
  var autoHideParsed = namedArguments[const Symbol('autoHide')];
  if (autoHideParsed != null) {
    autoHide = autoHideParsed as bool;
  }
  return DatePicker(
    date: date as String,
    autoHide: autoHide,
    onDateChanged: (s) {
      (onDateChanged as LoxFunction).call(interpreter, [s], {});
    },
  );
}