filter property

MessageFilter? filter
final

Optional message filter function.

When provided, all messages pass through this filter before reaching the model's update method. The filter can:

  • Return the message unchanged to allow it through
  • Return a modified message
  • Return null to filter out the message completely

Example:

final options = ProgramOptions(
  filter: (model, msg) {
    // Log all messages
    print('Message: $msg');
    return msg;
  },
);

Implementation

final MessageFilter? filter;