execute method

dynamic execute (GrinderContext _context, TaskArgs args)

This method is invoked when the task is started. If a task was created with a function, that function will be invoked by this method.

Implementation

dynamic execute(GrinderContext _context, TaskArgs args) {
  if (taskFunction == null) return null;

  if (taskFunction is TaskFunction) {
    return zonedContext.withValue(_context, () => taskFunction(args));
  } else if (taskFunction is _OldTaskFunction) {
    _context.log(
        "warning: task definitions no longer require an explicit 'GrinderContext' parameter");
    return zonedContext.withValue(_context, () => taskFunction(_context));
  } else {
    return zonedContext.withValue(_context, taskFunction);
  }
}