registerPolicy<T> static method

void registerPolicy<T>(
  1. bool canSee(
    1. T model
    )
)

Registers a policy filter for T. A change whose model fails the check is not delivered — policy runs before delivery, not in the UI.

Implementation

static void registerPolicy<T>(bool Function(T model) canSee) {
  _policies[T] = (Object? model) => model is T && canSee(model);
}