packageImport method
package: URI for path relative to the package root (under lib/).
Implementation
String packageImport(String path) {
final normalized = p.posix.normalize(path.replaceAll(r'\', '/'));
if (!normalized.startsWith('lib/')) {
throw StateError('$path must be inside lib/ to be importable.');
}
return 'package:$packageName/${normalized.substring(4)}';
}