when<T> abstract method

T when<T>({
  1. required T insert(
    1. int position,
    2. int count
    ),
  2. required T remove(
    1. int position,
    2. int count
    ),
  3. required T change(
    1. int position,
    2. Object? payload
    ),
  4. required T move(
    1. int from,
    2. int to
    ),
})

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

T when<T>({
  required T Function(int position, int count) insert,
  required T Function(int position, int count) remove,
  required T Function(int position, Object? payload) change,
  required T Function(int from, int to) move,
});