forPlatform method

  1. @override
Group? forPlatform(
  1. SuitePlatform platform
)
override

Returns a copy of this with all platform-specific metadata resolved.

Removes any tests and groups with Metadata.testOn selectors that don't match platform. Returns null if this entry's selector doesn't match.

Implementation

@override
Group? forPlatform(SuitePlatform platform) {
  if (!metadata.testOn.evaluate(platform)) return null;
  var newMetadata = metadata.forPlatform(platform);
  var filtered = _map((entry) => entry.forPlatform(platform));
  if (filtered.isEmpty && entries.isNotEmpty) return null;
  return Group(
    name,
    filtered,
    metadata: newMetadata,
    trace: trace,
    location: location,
    setUpAll: setUpAll?.forPlatform(platform),
    tearDownAll: tearDownAll?.forPlatform(platform),
  );
}