parseFiles static method

Future<Map<String, HitMap>> parseFiles(
  1. Iterable<File> files, {
  2. bool checkIgnoredLines = false,
  3. @Deprecated('Use packagePath') String? packagesPath,
  4. String? packagePath,
})

Generates a merged hitmap from a set of coverage JSON files.

Implementation

static Future<Map<String, HitMap>> parseFiles(
  Iterable<File> files, {
  bool checkIgnoredLines = false,
  @Deprecated('Use packagePath') String? packagesPath,
  String? packagePath,
}) async {
  final globalHitmap = <String, HitMap>{};
  for (var file in files) {
    final contents = file.readAsStringSync();
    final jsonMap = json.decode(contents) as Map<String, dynamic>;
    if (jsonMap.containsKey('coverage')) {
      final jsonResult = jsonMap['coverage'] as List;
      globalHitmap.merge(await HitMap.parseJson(
        jsonResult.cast<Map<String, dynamic>>(),
        checkIgnoredLines: checkIgnoredLines,
        // ignore: deprecated_member_use_from_same_package
        packagesPath: packagesPath,
        packagePath: packagePath,
      ));
    }
  }
  return globalHitmap;
}