getExecutionHistory method

List<HookExecutionEvent> getExecutionHistory({
  1. HookType? type,
  2. int? limit,
})

Get execution history, optionally filtered by type and/or limited.

Implementation

List<HookExecutionEvent> getExecutionHistory({HookType? type, int? limit}) {
  Iterable<HookExecutionEvent> results = _history;

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

  final list = results.toList();
  if (limit != null && list.length > limit) {
    return list.sublist(0, limit);
  }
  return list;
}