Fix analysis errors
diff --git a/lib/src/collect.dart b/lib/src/collect.dart
index c347556..e531640 100644
--- a/lib/src/collect.dart
+++ b/lib/src/collect.dart
@@ -196,12 +196,10 @@
     IsolateRef isolateRef,
     Script script,
     FuncRef funcRef,
-    Map<ScriptRef, Set<int>> libFuncs,
     HitMap hits) async {
   final func = await service.getObject(isolateRef.id!, funcRef.id!) as Func;
   final location = func.location;
   if (location != null) {
-    final scriptFuncs = libFuncs.putIfAbsent(location.script!, () => <int>{});
     final funcName = await _getFuncName(service, isolateRef, func);
     final tokenPos = location.tokenPos!;
     final line = _getLineFromTokenPos(script, tokenPos);
@@ -210,7 +208,6 @@
       print('tokenPos $tokenPos has no line mapping for script ${script.uri!}');
       return;
     }
-    scriptFuncs.add(line);
     hits.funcNames[line] = funcName;
   }
 }
@@ -247,11 +244,9 @@
       libraries.add(libRef);
       final library =
           await service.getObject(isolateRef.id!, libRef.id!) as Library;
-      final Map<ScriptRef, Set<int>> libFuncs = {};
       if (library.functions != null) {
         for (var funcRef in library.functions!) {
-          await _processFunction(
-              service, isolateRef, script, funcRef, libFuncs, hits);
+          await _processFunction(service, isolateRef, script, funcRef, hits);
         }
       }
       if (library.classes != null) {
@@ -261,7 +256,7 @@
           if (clazz.functions != null) {
             for (var funcRef in clazz.functions!) {
               await _processFunction(
-                  service, isolateRef, script, funcRef, libFuncs, hits);
+                  service, isolateRef, script, funcRef, hits);
             }
           }
         }
@@ -310,12 +305,12 @@
 Future<String> _getFuncName(
     VmService service, IsolateRef isolateRef, Func func) async {
   if (func.name == null) {
-    return "${func.type}:${func.location!.tokenPos}";
+    return '${func.type}:${func.location!.tokenPos}';
   }
-  if (func.owner is ClassRef) {
-    final cls =
-        await service.getObject(isolateRef.id!, func.owner.id!) as Class;
-    if (cls.name != null) return "${cls.name}.${func.name}";
+  final owner = func.owner;
+  if (owner is ClassRef) {
+    final cls = await service.getObject(isolateRef.id!, owner.id!) as Class;
+    if (cls.name != null) return '${cls.name}.${func.name}';
   }
   return func.name!;
 }
diff --git a/lib/src/hitmap.dart b/lib/src/hitmap.dart
index 58e4e72..f2162c1 100644
--- a/lib/src/hitmap.dart
+++ b/lib/src/hitmap.dart
@@ -8,7 +8,6 @@
 import 'package:coverage/src/resolver.dart';
 import 'package:coverage/src/util.dart';
 
-
 /// Contains line and function hit information for a single script.
 class HitMap {
   /// Map from line to hit count for that line.
@@ -142,7 +141,7 @@
     fillHitMap(e['funcHits'] as List, sourceHitMap.funcHits);
     final funcNames = e['funcNames'] as List;
     for (var i = 0; i < funcNames.length; i += 2) {
-      sourceHitMap.funcNames[funcNames[i]] = funcNames[i + 1];
+      sourceHitMap.funcNames[funcNames[i] as int] = funcNames[i + 1] as String;
     }
   }
   return globalHitMap;
@@ -212,13 +211,12 @@
   List<T> flattenMap<T>(Map map) {
     final kvs = <T>[];
     map.forEach((k, v) {
-      kvs.add(k);
-      kvs.add(v);
+      kvs.add(k as T);
+      kvs.add(v as T);
     });
     return kvs;
   }
 
-  ;
   json['source'] = '$scriptUri';
   json['script'] = {
     'type': '@Script',
diff --git a/test/collect_coverage_test.dart b/test/collect_coverage_test.dart
index a27ee40..87e25e0 100644
--- a/test/collect_coverage_test.dart
+++ b/test/collect_coverage_test.dart
@@ -97,7 +97,7 @@
       12: 1,
       13: 1,
       15: 0,
-      21: 1,
+      19: 1,
       23: 1,
       24: 2,
       28: 1,
@@ -140,11 +140,11 @@
       expectedHits[42] = 3;
     }
     expect(isolateFile?.lineHits, expectedHits);
-    expect(isolateFile?.funcHits, {11: 1, 19: 0, 21: 1, 23: 1, 28: 1, 38: 1});
+    expect(isolateFile?.funcHits, {11: 1, 19: 1, 21: 0, 23: 1, 28: 1, 38: 1});
     expect(isolateFile?.funcNames, {
       11: 'fooSync',
-      19: 'BarClass.x=',
-      21: 'BarClass.BarClass',
+      19: 'BarClass.BarClass',
+      21: 'BarClass.x=',
       23: 'BarClass.baz',
       28: 'fooAsync',
       38: 'isolateTask'
diff --git a/test/run_and_collect_test.dart b/test/run_and_collect_test.dart
index b18ccf0..e287782 100644
--- a/test/run_and_collect_test.dart
+++ b/test/run_and_collect_test.dart
@@ -50,7 +50,7 @@
       12: 1,
       13: 1,
       15: 0,
-      21: 1,
+      19: 1,
       23: 1,
       24: 2,
       28: 1,
@@ -71,11 +71,11 @@
     };
 
     expect(actualLineHits, expectedLineHits);
-    expect(actualFuncHits, {11: 1, 19: 0, 21: 1, 23: 1, 28: 1, 38: 1});
+    expect(actualFuncHits, {11: 1, 19: 1, 21: 0, 23: 1, 28: 1, 38: 1});
     expect(actualFuncNames, {
       11: 'fooSync',
-      19: 'BarClass.x=',
-      21: 'BarClass.BarClass',
+      19: 'BarClass.BarClass',
+      21: 'BarClass.x=',
       23: 'BarClass.baz',
       28: 'fooAsync',
       38: 'isolateTask'
diff --git a/test/test_files/test_app_isolate.dart b/test/test_files/test_app_isolate.dart
index 19bef2b..fc8d723 100644
--- a/test/test_files/test_app_isolate.dart
+++ b/test/test_files/test_app_isolate.dart
@@ -16,10 +16,10 @@
 }
 
 class BarClass {
-  int x;
-
   BarClass(this.x);
 
+  int x;
+
   void baz() {
     print(x);
   }