when<S> method

  1. @override
S when<S>({
  1. S insert(
    1. INode data,
    2. int pos
    )?,
  2. S remove(
    1. INode data,
    2. int? pos
    )?,
  3. S add(
    1. INode data
    )?,
  4. required S update(
    1. INode update
    ),
})
override

call one of the given callback functions depending on the type of this object.

@param insert callback function to be called if this object is of type NodeInsert @param remove callback function to be called if this object is of type NodeRemove @param add callback function to be called if this object is of type NodeAdd

Implementation

@override
S when<S>({
  S Function(INode data, int pos)? insert,
  S Function(INode data, int? pos)? remove,
  S Function(INode data)? add,
  required S Function(INode update) update,
}) {
  return update(data);
}