The law does not require that  the officer be present in order for a judge to dismiss the case. However, some judges will exercise their discretion to not dismiss unless the officer is present and has the chance to object to the dismissal (and, if so, present his/her reasons why); and/or some judges may want the officer to consent to the dismissal. So the judge may require this, even though he/she is not required to do so.