onMutationChange method

  1. @override
void onMutationChange(
  1. Mutation mutation,
  2. MutationState nextState
)
override

Called when the state of a mutation changes.

Implementation

@override
void onMutationChange(
  Mutation<dynamic, dynamic> mutation,
  MutationState<dynamic> nextState,
) {
  if (!mutationChange) return;

  List<String> message;
  if (verbose) {
    message = [
      _AnsiColors("Prev State: ${mutation.state}", colors: colors)
          .green
          .toString(),
      _AnsiColors("", colors: colors).reset.toString(),
      _AnsiColors("Next State: $nextState", colors: colors).blue.toString(),
      _AnsiColors("", colors: colors).reset.toString(),
    ];
  } else {
    message = [
      "Prev State: ${mutation.state.status}",
      "Next State: ${nextState.status}",
    ];
  }
  _log(
    _AnsiColors("[MUTATION CHANGE]", colors: colors).blue.bold.toString(),
    message: message,
    key: mutation.key,
  );
}