endpointNorm function
String
endpointNorm(
- List<String> paths, {
- bool normSlashs = true,
- dynamic endWithSlash = true,
- dynamic startWithSlash = true,
})
Implementation
String endpointNorm(
List<String> paths, {
bool normSlashs = true,
endWithSlash = true,
startWithSlash = true,
}) {
var path = joinPaths(paths);
if (endWithSlash && !path.endsWith('/')) {
path += '/';
}
if (startWithSlash && !path.startsWith('/')) {
path = '/$path';
}
if (normSlashs) {
path = path.replaceAll('\\', '/');
}
path = path.replaceAll('//', '/');
return path;
}