prepare static method

PreparedIntegrationEntry? prepare({
  1. required String appDir,
  2. required String sourceRelativePath,
  3. required String source,
  4. required String packageName(),
  5. required bool sourceHasApplicationEntry,
})

Plans and validates the generated path before the patcher starts writing.

Implementation

static PreparedIntegrationEntry? prepare({
  required String appDir,
  required String sourceRelativePath,
  required String source,
  required String Function() packageName,
  required bool sourceHasApplicationEntry,
}) {
  final generated = IntegrationEntryGenerator.generate(
    sourceRelativePath: sourceRelativePath,
    source: source,
    packageName: packageName,
    sourceHasApplicationEntry: sourceHasApplicationEntry,
  );
  if (generated == null) return null;

  TestEntryValidator.validatePathWithinRoot(
    root: appDir,
    relativePath: generated.relativePath,
  );
  return PreparedIntegrationEntry(generated);
}