when<T> method

  1. @override
T when<T>({
  1. required T insert(
    1. int p1,
    2. int p2
    ),
  2. required T remove(
    1. int p1,
    2. int p2
    ),
  3. required T change(
    1. int p1,
    2. Object? p2
    ),
  4. required T move(
    1. int p1,
    2. int p2
    ),
})
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 Insert @param remove callback function to be called if this object is of type Remove @param change callback function to be called if this object is of type Change @param move callback function to be called if this object is of type Move

Implementation

@override
T when<T>(
    {required T Function(int p1, int p2) insert,
    required T Function(int p1, int p2) remove,
    required T Function(int p1, Object? p2) change,
    required T Function(int p1, int p2) move}) {
  return change(position, payload);
}