getRegistered method

List<HookRegistration> getRegistered({
  1. HookType? type,
  2. HookPriority? priority,
})

Get all registered hooks, optionally filtered by type and/or priority.

Implementation

List<HookRegistration> getRegistered({
  HookType? type,
  HookPriority? priority,
}) {
  Iterable<HookRegistration> results = _registrationsById.values;

  if (type != null) {
    results = results.where((r) => r.type == type);
  }
  if (priority != null) {
    results = results.where((r) => r.priority == priority);
  }

  final list = results.toList()
    ..sort((a, b) => a.priority.value.compareTo(b.priority.value));
  return list;
}