devToolsFileFromPath static method
Returns a DevTools file from the given path.
Only files within ~/.flutter-devtools/ can be accessed.
Implementation
static File? devToolsFileFromPath(String pathFromDevToolsDir) {
if (pathFromDevToolsDir.contains('..')) {
// The passed in path should not be able to walk up the directory tree
// outside of the ~/.flutter-devtools/ directory.
return null;
}
ensureDevToolsDirectory();
final file = File(path.join(devToolsDir(), pathFromDevToolsDir));
if (!file.existsSync()) {
return null;
}
return file;
}