parseTraceFile function

Future<Map<String, Object>?> parseTraceFile(
  1. String path, {
  2. FileSystem? fileSystem,
})

Implementation

Future<Map<String, Object>?> parseTraceFile(
  String path, {
  FileSystem? fileSystem,
}) async {
  final fs = fileSystem ?? getDefaultFileSystem();
  final file = fs.file(path);
  if (!await file.exists()) return null;

  final String content;
  if (path.endsWith('.gz')) {
    final bytes = await file.readAsBytes();
    final decompressed = await decompressGzip(bytes);
    content = utf8.decode(decompressed);
  } else {
    content = await file.readAsString();
  }

  return _parseTraceJsonContent(content);
}