filter method

  1. @override
Group? filter(
  1. bool callback(
    1. Test
    )
)
override

Returns a copy of this with all tests that don't match callback removed.

Returns null if this is a test that doesn't match callback or a group where no child tests match callback.

Implementation

@override
Group? filter(bool Function(Test) callback) {
  var filtered = _map((entry) => entry.filter(callback));
  if (filtered.isEmpty && entries.isNotEmpty) return null;
  return Group(
    name,
    filtered,
    metadata: metadata,
    trace: trace,
    location: location,
    // Always clone these because they are being re-parented.
    setUpAll: setUpAll?.clone(),
    tearDownAll: tearDownAll?.clone(),
  );
}