call method
Implementation
@override
Object? call(Interpreter interpreter, List<Object?> arguments,
Map<Symbol, Object?> namedArguments) {
if (arguments.isEmpty) {
throw "Argument must be at least 1.";
}
var year = arguments[0] as int;
if (arguments.length == 1) {
return DateTime(year);
}
var month = arguments[1] as int;
if (arguments.length == 2) {
return DateTime(year, month);
}
var day = arguments[2] as int;
if (arguments.length == 3) {
return DateTime(year, month, day);
}
var hour = arguments[3] as int;
if (arguments.length == 4) {
return DateTime(year, month, day, hour);
}
var minute = arguments[4] as int;
if (arguments.length == 5) {
return DateTime(year, month, day, hour, minute);
}
var second = arguments[5] as int;
if (arguments.length == 6) {
return DateTime(year, month, day, hour, minute, second);
}
var millisecond = arguments[6] as int;
if (arguments.length == 7) {
return DateTime(year, month, day, hour, minute, second, millisecond);
}
}