contextPathSplit function
Split the parts in a given context
Handle both / and \ separator
Implementation
List<String> contextPathSplit(Context context, String path) {
if (path.isEmpty) {
throw ArgumentError.value(
path, 'path', 'contextPathSplit path should not be empty');
}
/// We split in the windows context
var parts = windows.split(path);
var rootPart = parts[0];
if (isPathPartSeparator(rootPart) && context.separator != rootPart) {
parts[0] = context.separator;
}
// Handle /C:/ parsing
if (parts.length > 1 && parts[1].endsWith(':')) {
parts = parts.sublist(1);
}
return parts;
}