normalizeUri method
Normalizes a Uri via normalizePath.
Implementation
Uri normalizeUri(Uri uri) {
if (uri.isScheme('file')) {
final filePath = uri.toFilePath();
final normalizedPath = normalizePath(filePath);
return Uri.file(normalizedPath);
} else if (uri.scheme.endsWith('+file')) {
// For virtual file schemes, we need to replace the scheme to use
// toFilePath() so we can normalise the path, then convert back.
final originalScheme = uri.scheme;
final filePath = uri.replace(scheme: 'file').toFilePath();
final normalizedPath = normalizePath(filePath);
return Uri.file(normalizedPath).replace(scheme: originalScheme);
} else {
return uri;
}
}