resolveFilePath method

String resolveFilePath(
  1. String packagePath
)

Resolves a package path (e.g., "package:my_app/...") to an absolute file path by joining the dynamic project root with the lib folder.

Implementation

String resolveFilePath(String packagePath) {
  if (packagePath.startsWith('package:')) {
    final projectRoot = getDynamicProjectRoot();
    // Extract the package-relative path.
    final relativePath = packagePath.replaceFirst(RegExp(r'package:[^/]+/'), '');
    final resolved = p.join(projectRoot, 'lib', relativePath);
    return resolved;
  }
  return packagePath;
}