devToolsFileAsJson method
Returns a DevTools file from the given path as encoded JSON.
Only files within ~/.flutter-devtools/ can be accessed.
Implementation
String? devToolsFileAsJson(String relativePath) {
final targetFile = devToolsFileFromPath(relativePath);
if (targetFile == null) return null;
final fileName = path.basename(targetFile.path);
if (!fileName.endsWith('.json')) return null;
final content = targetFile.readAsStringSync();
final json = jsonDecode(content) as Map;
json['lastModifiedTime'] = targetFile.lastModifiedSync().toString();
return jsonEncode(json);
}