fix pedantic lints (#37)

diff --git a/example/http_server.dart b/example/http_server.dart
index 0072d52..115c49d 100644
--- a/example/http_server.dart
+++ b/example/http_server.dart
@@ -4,17 +4,17 @@
 
 library isolate.example.http_server;
 
-import "dart:async";
-import "dart:io";
-import "dart:isolate";
+import 'dart:async';
+import 'dart:io';
+import 'dart:isolate';
 
-import "package:isolate/isolate_runner.dart";
-import "package:isolate/ports.dart";
-import "package:isolate/runner.dart";
+import 'package:isolate/isolate_runner.dart';
+import 'package:isolate/ports.dart';
+import 'package:isolate/runner.dart';
 
 Future<Future<Object> Function()> runHttpServer(
     Runner runner, int port, HttpListener listener) async {
-  SendPort stopPort = await runner.run(_startHttpServer, [port, listener]);
+  var stopPort = await runner.run(_startHttpServer, [port, listener]);
 
   return () => _sendStop(stopPort);
 }
@@ -57,31 +57,33 @@
 
   EchoHttpListener(this._counter);
 
+  @override
   Future start(HttpServer server) async {
-    print("Starting isolate $_id");
+    print('Starting isolate $_id');
     _subscription = server.listen((HttpRequest request) async {
       await request.response.addStream(request);
-      print("Request to $hashCode");
-      request.response.write("#$_id\n");
+      print('Request to $hashCode');
+      request.response.write('#$_id\n');
       var watch = Stopwatch()..start();
       while (watch.elapsed < _delay) {
         await Future.delayed(const Duration(milliseconds: 100));
       }
-      print("Response from $_id");
+      print('Response from $_id');
       await request.response.close();
       _counter.send(null);
     });
   }
 
+  @override
   Future stop() async {
-    print("Stopping isolate $_id");
+    print('Stopping isolate $_id');
     await _subscription.cancel();
     _subscription = null;
   }
 }
 
-main(List<String> args) async {
-  int port = 0;
+void main(List<String> args) async {
+  var port = 0;
   if (args.isNotEmpty) {
     port = int.parse(args[0]);
   }
@@ -91,7 +93,7 @@
 
   // Used to ensure the requested port is available or to find an available
   // port if `0` is provided.
-  ServerSocket socket =
+  var socket =
       await ServerSocket.bind(InternetAddress.anyIPv6, port, shared: true);
 
   port = socket.port;
@@ -100,30 +102,29 @@
     isolate.close();
   });
 
-  List<Future<Object> Function()> stoppers =
-      await Future.wait(isolates.map((IsolateRunner isolate) {
+  var stoppers = await Future.wait(isolates.map((IsolateRunner isolate) {
     return runHttpServer(isolate, socket.port, listener);
   }), cleanUp: (shutdownServer) {
     shutdownServer();
   });
 
   await socket.close();
-  int count = 25;
+  var count = 25;
 
-  print("Server listening on port $port for $count requests");
-  print("Test with:");
-  print("  ab -l -c10 -n $count http://localhost:$port/");
+  print('Server listening on port $port for $count requests');
+  print('Test with:');
+  print('  ab -l -c10 -n $count http://localhost:$port/');
   print("where 'ab' is ApacheBench from, e.g., apache2_tools.");
 
   await for (var _ in counter) {
     count--;
     if (count == 0) {
-      print("Shutting down");
+      print('Shutting down');
       for (var stopper in stoppers) {
         await stopper();
       }
       counter.close();
     }
   }
-  print("Finished");
+  print('Finished');
 }
diff --git a/example/runner_pool.dart b/example/runner_pool.dart
index 3439f05..a201239 100644
--- a/example/runner_pool.dart
+++ b/example/runner_pool.dart
@@ -4,26 +4,26 @@
 
 library isolate.example.runner_pool;
 
-import "dart:async" show Future;
+import 'dart:async' show Future;
 
-import "package:isolate/load_balancer.dart";
-import "package:isolate/isolate_runner.dart";
+import 'package:isolate/load_balancer.dart';
+import 'package:isolate/isolate_runner.dart';
 
 void main() {
-  int N = 44;
+  var N = 44;
   var sw = Stopwatch()..start();
   // Compute fib up to 42 with 4 isolates.
   parfib(N, 4).then((v1) {
     var t1 = sw.elapsedMilliseconds;
     sw.stop();
     sw.reset();
-    print("fib#4($N) = ${v1[N]}, ms: $t1");
+    print('fib#4($N) = ${v1[N]}, ms: $t1');
     sw.start();
     // Then compute fib up to 42 with 2 isolates.
     parfib(N, 2).then((v2) {
       var t2 = sw.elapsedMilliseconds;
       sw.stop();
-      print("fib#2($N) = ${v2[N]}, ms: $t2");
+      print('fib#2($N) = ${v2[N]}, ms: $t2');
     });
   });
 }
@@ -35,7 +35,7 @@
     var fibs = List<Future<int>>(limit + 1);
     // Schedule all calls with exact load value and the heaviest task
     // assigned first.
-    schedule(a, b, i) {
+    void schedule(a, b, i) {
       if (i < limit) {
         schedule(a + b, a, i + 1);
       }
diff --git a/lib/isolate.dart b/lib/isolate.dart
index eeb6e7e..268a232 100644
--- a/lib/isolate.dart
+++ b/lib/isolate.dart
@@ -5,8 +5,8 @@
 /// Utilities for working with isolates and isolate communication.
 library isolate;
 
-export "isolate_runner.dart";
-export "load_balancer.dart";
-export "ports.dart";
-export "registry.dart";
-export "runner.dart";
+export 'isolate_runner.dart';
+export 'load_balancer.dart';
+export 'ports.dart';
+export 'registry.dart';
+export 'runner.dart';
diff --git a/lib/isolate_runner.dart b/lib/isolate_runner.dart
index 1317fd4..81aa1bb 100644
--- a/lib/isolate_runner.dart
+++ b/lib/isolate_runner.dart
@@ -4,12 +4,12 @@
 
 library isolate.isolate_runner;
 
-import "dart:async";
-import "dart:isolate";
+import 'dart:async';
+import 'dart:isolate';
 
-import "ports.dart";
-import "runner.dart";
-import "src/util.dart";
+import 'ports.dart';
+import 'runner.dart';
+import 'src/util.dart';
 
 // Command tags. Shared between IsolateRunner and IsolateRunnerRemote.
 const int _shutdown = 0;
@@ -76,6 +76,7 @@
   /// Can be used to create an isolate, use [run] to start a service, and
   /// then drop the connection and let the service control the isolate's
   /// life cycle.
+  @override
   Future<void> close() {
     var channel = SingleResponseChannel();
     _commandPort.send(list2(_shutdown, channel.port));
@@ -100,7 +101,7 @@
   ///  .timeout(new Duration(...), onTimeout: () => print("No response"));
   /// ```
   Future<void> kill({Duration timeout = const Duration(seconds: 1)}) {
-    Future<void> onExit = singleResponseFuture(isolate.addOnExitListener);
+    var onExit = singleResponseFuture(isolate.addOnExitListener);
     if (Duration.zero == timeout) {
       isolate.kill(priority: Isolate.immediate);
       return onExit;
@@ -150,7 +151,7 @@
   /// has no further effect. Only a single call to [resume] is needed
   /// to resume the isolate.
   void pause([Capability resumeCapability]) {
-    if (resumeCapability == null) resumeCapability = isolate.pauseCapability;
+    resumeCapability ??= isolate.pauseCapability;
     isolate.pause(resumeCapability);
   }
 
@@ -162,7 +163,7 @@
   /// Even if `pause` has been called more than once with the same
   /// `resumeCapability`, a single resume call with stop the pause.
   void resume([Capability resumeCapability]) {
-    if (resumeCapability == null) resumeCapability = isolate.pauseCapability;
+    resumeCapability ??= isolate.pauseCapability;
     isolate.resume(resumeCapability);
   }
 
@@ -186,8 +187,9 @@
   ///   await iso.close();
   /// }
   /// ```
-  Future<R> run<R, P>(FutureOr<R> function(P argument), P argument,
-      {Duration timeout, onTimeout()}) {
+  @override
+  Future<R> run<R, P>(FutureOr<R> Function(P argument) function, P argument,
+      {Duration timeout, Function() onTimeout}) {
     return singleResultFuture<R>((SendPort port) {
       _commandPort.send(list4(_run, function, argument, port));
     }, timeout: timeout, onTimeout: onTimeout);
diff --git a/lib/load_balancer.dart b/lib/load_balancer.dart
index dcfa10c..30c3791 100644
--- a/lib/load_balancer.dart
+++ b/lib/load_balancer.dart
@@ -5,11 +5,11 @@
 /// A load-balancing runner pool.
 library isolate.load_balancer;
 
-import "dart:async" show Future, FutureOr;
+import 'dart:async' show Future, FutureOr;
 
-import "runner.dart";
-import "src/errors.dart";
-import "src/util.dart";
+import 'runner.dart';
+import 'src/errors.dart';
+import 'src/util.dart';
 
 /// A pool of runners, ordered by load.
 ///
@@ -32,7 +32,7 @@
   LoadBalancer._(List<_LoadBalancerEntry> entries)
       : _queue = entries,
         _length = entries.length {
-    for (int i = 0; i < _length; i++) {
+    for (var i = 0; i < _length; i++) {
       _queue[i].queueIndex = i;
     }
   }
@@ -47,7 +47,8 @@
   /// ```dart
   /// var isolatePool = LoadBalancer.create(10, IsolateRunner.spawn);
   /// ```
-  static Future<LoadBalancer> create(int size, Future<Runner> createRunner()) {
+  static Future<LoadBalancer> create(
+      int size, Future<Runner> Function() createRunner) {
     return Future.wait(Iterable.generate(size, (_) => createRunner()),
         cleanUp: (Runner runner) {
       runner.close();
@@ -71,10 +72,11 @@
   /// the runner running the function, which will handle a timeout
   /// as normal. If the runners are running in other isolates, then
   /// the [onTimeout] function must be a constant function.
-  Future<R> run<R, P>(FutureOr<R> function(P argument), argument,
-      {Duration timeout, FutureOr<R> onTimeout(), int load = 100}) {
-    RangeError.checkNotNegative(load, "load");
-    _LoadBalancerEntry entry = _first;
+  @override
+  Future<R> run<R, P>(FutureOr<R> Function(P argument) function, argument,
+      {Duration timeout, FutureOr<R> Function() onTimeout, int load = 100}) {
+    RangeError.checkNotNegative(load, 'load');
+    var entry = _first;
     _increaseLoad(entry, load);
     return entry.run(this, load, function, argument, timeout, onTimeout);
   }
@@ -94,10 +96,10 @@
   /// the runners running the function, which will handle any timeouts
   /// as normal.
   List<Future<R>> runMultiple<R, P>(
-      int count, FutureOr<R> function(P argument), P argument,
-      {Duration timeout, FutureOr<R> onTimeout(), int load = 100}) {
-    RangeError.checkValueInInterval(count, 1, _length, "count");
-    RangeError.checkNotNegative(load, "load");
+      int count, FutureOr<R> Function(P argument) function, P argument,
+      {Duration timeout, FutureOr<R> Function() onTimeout, int load = 100}) {
+    RangeError.checkValueInInterval(count, 1, _length, 'count');
+    RangeError.checkNotNegative(load, 'load');
     if (count == 1) {
       return List<Future<R>>(1)
         ..[0] = run(function, argument,
@@ -106,8 +108,8 @@
     var result = List<Future<R>>(count);
     if (count == _length) {
       // No need to change the order of entries in the queue.
-      for (int i = 0; i < count; i++) {
-        _LoadBalancerEntry entry = _queue[i];
+      for (var i = 0; i < count; i++) {
+        var entry = _queue[i];
         entry.load += load;
         result[i] =
             entry.run(this, load, function, argument, timeout, onTimeout);
@@ -120,11 +122,11 @@
       // We can't assume that the first [count] entries in the
       // heap list are the least loaded.
       var entries = List<_LoadBalancerEntry>(count);
-      for (int i = 0; i < count; i++) {
+      for (var i = 0; i < count; i++) {
         entries[i] = _removeFirst();
       }
-      for (int i = 0; i < count; i++) {
-        _LoadBalancerEntry entry = entries[i];
+      for (var i = 0; i < count; i++) {
+        var entry = entries[i];
         entry.load += load;
         _add(entry);
         result[i] =
@@ -134,13 +136,14 @@
     return result;
   }
 
+  @override
   Future<void> close() {
     if (_stopFuture != null) return _stopFuture;
     _stopFuture =
         MultiError.waitUnordered(_queue.take(_length).map((e) => e.close()))
             .then(ignore);
     // Remove all entries.
-    for (int i = 0; i < _length; i++) {
+    for (var i = 0; i < _length; i++) {
       _queue[i].queueIndex = -1;
     }
     _queue = null;
@@ -155,8 +158,8 @@
   /// parent, swap it with the parent.
   void _bubbleUp(_LoadBalancerEntry element, int index) {
     while (index > 0) {
-      int parentIndex = (index - 1) ~/ 2;
-      _LoadBalancerEntry parent = _queue[parentIndex];
+      var parentIndex = (index - 1) ~/ 2;
+      var parent = _queue[parentIndex];
       if (element.compareTo(parent) > 0) break;
       _queue[index] = parent;
       parent.queueIndex = index;
@@ -173,12 +176,12 @@
   /// swap it with the highest priority child.
   void _bubbleDown(_LoadBalancerEntry element, int index) {
     while (true) {
-      int childIndex = index * 2 + 1; // Left child index.
+      var childIndex = index * 2 + 1; // Left child index.
       if (childIndex >= _length) break;
-      _LoadBalancerEntry child = _queue[childIndex];
-      int rightChildIndex = childIndex + 1;
+      var child = _queue[childIndex];
+      var rightChildIndex = childIndex + 1;
       if (rightChildIndex < _length) {
-        _LoadBalancerEntry rightChild = _queue[rightChildIndex];
+        var rightChild = _queue[rightChildIndex];
         if (rightChild.compareTo(child) < 0) {
           childIndex = rightChildIndex;
           child = rightChild;
@@ -198,11 +201,11 @@
   /// The entry is expected to be either added back to the queue
   /// immediately or have its stop method called.
   void _remove(_LoadBalancerEntry entry) {
-    int index = entry.queueIndex;
+    var index = entry.queueIndex;
     if (index < 0) return;
     entry.queueIndex = -1;
     _length--;
-    _LoadBalancerEntry replacement = _queue[_length];
+    var replacement = _queue[_length];
     _queue[_length] = null;
     if (index < _length) {
       if (entry.compareTo(replacement) < 0) {
@@ -215,12 +218,12 @@
 
   /// Adds entry to the queue.
   void _add(_LoadBalancerEntry entry) {
-    if (_stopFuture != null) throw StateError("LoadBalancer is stopped");
+    if (_stopFuture != null) throw StateError('LoadBalancer is stopped');
     assert(entry.queueIndex < 0);
     if (_queue.length == _length) {
       _grow();
     }
-    int index = _length;
+    var index = _length;
     _length = index + 1;
     _bubbleUp(entry, index);
   }
@@ -242,7 +245,7 @@
   }
 
   void _grow() {
-    List newQueue = List(_length * 2);
+    var newQueue = List(_length * 2);
     newQueue.setRange(0, _length, _queue);
     _queue = newQueue;
   }
@@ -253,7 +256,7 @@
   }
 
   _LoadBalancerEntry _removeFirst() {
-    _LoadBalancerEntry result = _first;
+    var result = _first;
     _remove(result);
     return result;
   }
@@ -277,10 +280,10 @@
   Future<R> run<R, P>(
       LoadBalancer balancer,
       int load,
-      FutureOr<R> function(P argument),
+      FutureOr<R> Function(P argument) function,
       argument,
       Duration timeout,
-      FutureOr<R> onTimeout()) {
+      FutureOr<R> Function() onTimeout) {
     return runner
         .run<R, P>(function, argument, timeout: timeout, onTimeout: onTimeout)
         .whenComplete(() {
@@ -290,5 +293,6 @@
 
   Future close() => runner.close();
 
+  @override
   int compareTo(_LoadBalancerEntry other) => load - other.load;
 }
diff --git a/lib/ports.dart b/lib/ports.dart
index 3fcdcb3..478e984 100644
--- a/lib/ports.dart
+++ b/lib/ports.dart
@@ -19,10 +19,10 @@
 /// does something with it, or puts it into a [Future] or [Completer].
 library isolate.ports;
 
-import "dart:async";
-import "dart:isolate";
+import 'dart:async';
+import 'dart:isolate';
 
-import "src/util.dart";
+import 'src/util.dart';
 
 /// Create a [SendPort] that accepts only one message.
 ///
@@ -46,10 +46,10 @@
 ///       ..first.timeout(duration, () => timeoutValue).then(callback))
 ///     .sendPort
 /// ```
-SendPort singleCallbackPort<P>(void callback(P response),
+SendPort singleCallbackPort<P>(void Function(P response) callback,
     {Duration timeout, P timeoutValue}) {
-  RawReceivePort responsePort = RawReceivePort();
-  Zone zone = Zone.current;
+  var responsePort = RawReceivePort();
+  var zone = Zone.current;
   callback = zone.registerUnaryCallback(callback);
   Timer timer;
   responsePort.handler = (response) {
@@ -93,15 +93,15 @@
 ///
 /// Returns the `SendPort` expecting the single message.
 SendPort singleCompletePort<R, P>(Completer<R> completer,
-    {FutureOr<R> callback(P message),
+    {FutureOr<R> Function(P message) callback,
     Duration timeout,
-    FutureOr<R> onTimeout()}) {
+    FutureOr<R> Function() onTimeout}) {
   if (callback == null && timeout == null) {
     return singleCallbackPort<Object>((response) {
       _castComplete<R>(completer, response);
     });
   }
-  RawReceivePort responsePort = RawReceivePort();
+  var responsePort = RawReceivePort();
   Timer timer;
   if (callback == null) {
     responsePort.handler = (response) {
@@ -110,7 +110,7 @@
       _castComplete<R>(completer, response);
     };
   } else {
-    Zone zone = Zone.current;
+    var zone = Zone.current;
     var action = zone.registerUnaryCallback((response) {
       try {
         // Also catch it if callback throws.
@@ -132,7 +132,7 @@
         completer.complete(Future.sync(onTimeout));
       } else {
         completer
-            .completeError(TimeoutException("Future not completed", timeout));
+            .completeError(TimeoutException('Future not completed', timeout));
       }
     });
   }
@@ -159,12 +159,12 @@
 /// If you want a timeout on the returned future, it's recommended to
 /// use the [timeout] parameter, and not [Future.timeout] on the result.
 /// The `Future` method won't be able to close the underlying [ReceivePort].
-Future<R> singleResponseFuture<R>(void action(SendPort responsePort),
+Future<R> singleResponseFuture<R>(void Function(SendPort responsePort) action,
     {Duration timeout, R timeoutValue}) {
-  Completer<R> completer = Completer<R>.sync();
-  RawReceivePort responsePort = RawReceivePort();
+  var completer = Completer<R>.sync();
+  var responsePort = RawReceivePort();
   Timer timer;
-  Zone zone = Zone.current;
+  var zone = Zone.current;
   responsePort.handler = (Object response) {
     responsePort.close();
     timer?.cancel();
@@ -200,7 +200,7 @@
   future.then((value) {
     resultPort.send(list1(value));
   }, onError: (error, stack) {
-    resultPort.send(list2("$error", "$stack"));
+    resultPort.send(list2('$error', '$stack'));
   });
 }
 
@@ -222,10 +222,10 @@
 /// instead.
 /// If `onTimeout` is omitted, it defaults to throwing
 /// a [TimeoutException].
-Future<R> singleResultFuture<R>(void action(SendPort responsePort),
-    {Duration timeout, FutureOr<R> onTimeout()}) {
+Future<R> singleResultFuture<R>(void Function(SendPort responsePort) action,
+    {Duration timeout, FutureOr<R> Function() onTimeout}) {
   var completer = Completer<R>.sync();
-  SendPort port = singleCompletePort<R, List<Object>>(completer,
+  var port = singleCompletePort<R, List<Object>>(completer,
       callback: receiveFutureResult, timeout: timeout, onTimeout: onTimeout);
   try {
     action(port);
@@ -289,10 +289,10 @@
   /// If `onTimeout` is not provided either,
   /// the future is completed with `timeoutValue`, which defaults to `null`.
   SingleResponseChannel(
-      {FutureOr<R> callback(Null value),
+      {FutureOr<R> Function(Null value) callback,
       Duration timeout,
       bool throwOnTimeout = false,
-      FutureOr<R> onTimeout(),
+      FutureOr<R> Function() onTimeout,
       R timeoutValue})
       : _receivePort = RawReceivePort(),
         _completer = Completer<R>.sync(),
@@ -306,7 +306,7 @@
         if (!_completer.isCompleted) {
           if (throwOnTimeout) {
             _completer.completeError(
-                TimeoutException("Timeout waiting for response", timeout));
+                TimeoutException('Timeout waiting for response', timeout));
           } else if (onTimeout != null) {
             _completer.complete(Future.sync(onTimeout));
           } else {
diff --git a/lib/registry.dart b/lib/registry.dart
index 9fbfbc2..621fb1b 100644
--- a/lib/registry.dart
+++ b/lib/registry.dart
@@ -5,13 +5,13 @@
 /// An isolate-compatible object registry and lookup service.
 library isolate.registry;
 
-import "dart:async" show Future, Completer, TimeoutException;
-import "dart:collection" show HashMap, HashSet;
-import "dart:isolate" show RawReceivePort, SendPort, Capability;
+import 'dart:async' show Future, Completer, TimeoutException;
+import 'dart:collection' show HashMap, HashSet;
+import 'dart:isolate' show RawReceivePort, SendPort, Capability;
 
-import "isolate_runner.dart"; // For documentation.
-import "ports.dart";
-import "src/util.dart";
+import 'isolate_runner.dart'; // For documentation.
+import 'ports.dart';
+import 'src/util.dart';
 
 // Command tags.
 const int _addValue = 0;
@@ -133,9 +133,9 @@
   ///
   /// Throws if [element] is not an element in the registry.
   int _getId(T element) {
-    int id = _cache.id(element);
+    var id = _cache.id(element);
     if (id == null) {
-      throw StateError("Not an element: ${Error.safeToString(element)}");
+      throw StateError('Not an element: ${Error.safeToString(element)}');
     }
     return id;
   }
@@ -154,15 +154,15 @@
   /// it preserves equality when sent through a [SendPort].
   /// This makes [Capability] objects a good choice for tags.
   Future<Capability> add(T element, {Iterable tags}) {
-    _RegistryCache cache = _cache;
+    var cache = _cache;
     if (cache.contains(element)) {
       return Future<Capability>.sync(() {
         throw StateError(
-            "Object already in registry: ${Error.safeToString(element)}");
+            'Object already in registry: ${Error.safeToString(element)}');
       });
     }
     var completer = Completer<Capability>();
-    SendPort port = singleCompletePort(completer,
+    var port = singleCompletePort(completer,
         callback: (List response) {
           assert(cache.isAdding(element));
           int id = response[0];
@@ -173,7 +173,7 @@
         timeout: _timeout,
         onTimeout: () {
           cache.stopAdding(element);
-          throw TimeoutException("Future not completed", _timeout);
+          throw TimeoutException('Future not completed', _timeout);
         });
     if (tags != null) tags = tags.toList(growable: false);
     cache.setAdding(element);
@@ -190,12 +190,12 @@
   /// when the object was added. If the capability is wrong, the
   /// object is not removed, and this function returns false.
   Future<bool> remove(T element, Capability removeCapability) {
-    int id = _cache.id(element);
+    var id = _cache.id(element);
     if (id == null) {
       return Future<bool>.value(false);
     }
     var completer = Completer<bool>();
-    SendPort port = singleCompletePort(completer, callback: (bool result) {
+    var port = singleCompletePort(completer, callback: (bool result) {
       _cache.remove(id);
       return result;
     }, timeout: _timeout);
@@ -228,7 +228,7 @@
     List ids = elements.map(_getId).toList(growable: false);
     tags = tags.toList(growable: false);
     var completer = Completer<void>();
-    SendPort port = singleCompletePort(completer, timeout: _timeout);
+    var port = singleCompletePort(completer, timeout: _timeout);
     _commandPort.send(list4(_removeTagsValue, ids, tags, port));
     return completer.future;
   }
@@ -236,7 +236,7 @@
   Future<void> _addTags(List<int> ids, Iterable tags) {
     tags = tags.toList(growable: false);
     var completer = Completer<void>();
-    SendPort port = singleCompletePort(completer, timeout: _timeout);
+    var port = singleCompletePort(completer, timeout: _timeout);
     _commandPort.send(list4(_addTagsValue, ids, tags, port));
     return completer.future;
   }
@@ -252,16 +252,16 @@
   /// Otherwise all matching elements are returned.
   Future<List<T>> lookup({Iterable<Object> tags, int max}) {
     if (max != null && max < 1) {
-      throw RangeError.range(max, 1, null, "max");
+      throw RangeError.range(max, 1, null, 'max');
     }
     if (tags != null) tags = tags.toList(growable: false);
     var completer = Completer<List<T>>();
-    SendPort port = singleCompletePort(completer, callback: (List response) {
+    var port = singleCompletePort(completer, callback: (List response) {
       // Response is even-length list of (id, element) pairs.
-      _RegistryCache cache = _cache;
-      int count = response.length ~/ 2;
-      List<T> result = List(count);
-      for (int i = 0; i < count; i++) {
+      var cache = _cache;
+      var count = response.length ~/ 2;
+      var result = List<T>(count);
+      for (var i = 0; i < count; i++) {
         var id = response[i * 2] as int;
         var element = response[i * 2 + 1] as T;
         element = cache.register(id, element);
@@ -286,7 +286,7 @@
   final Map<Object, int> object2id = HashMap.identity();
 
   int id(Object object) {
-    int result = object2id[object];
+    var result = object2id[object];
     if (result == _beingAdded) return null;
     return result;
   }
@@ -385,12 +385,12 @@
         _find(command[1] as List, command[2] as int, command[3] as SendPort);
         return;
       default:
-        throw UnsupportedError("Unknown command: ${command[0]}");
+        throw UnsupportedError('Unknown command: ${command[0]}');
     }
   }
 
   void _add(Object object, List tags, SendPort replyPort) {
-    int id = ++_nextId;
+    var id = ++_nextId;
     var entry = _RegistryEntry(id, object);
     _entries[id] = entry;
     if (tags != null) {
@@ -403,7 +403,7 @@
   }
 
   void _remove(int id, Capability removeCapability, SendPort replyPort) {
-    _RegistryEntry entry = _entries[id];
+    var entry = _entries[id];
     if (entry == null || entry.removeCapability != removeCapability) {
       replyPort.send(false);
       return;
@@ -418,8 +418,8 @@
   void _addTags(List<int> ids, List tags, SendPort replyPort) {
     assert(tags != null);
     assert(tags.isNotEmpty);
-    for (int id in ids) {
-      _RegistryEntry entry = _entries[id];
+    for (var id in ids) {
+      var entry = _entries[id];
       if (entry == null) continue; // Entry was removed.
       entry.tags.addAll(tags);
       for (var tag in tags) {
@@ -433,8 +433,8 @@
   void _removeTags(List<int> ids, List tags, SendPort replyPort) {
     assert(tags != null);
     assert(tags.isNotEmpty);
-    for (int id in ids) {
-      _RegistryEntry entry = _entries[id];
+    for (var id in ids) {
+      var entry = _entries[id];
       if (entry == null) continue; // Object was removed.
       entry.tags.removeAll(tags);
     }
@@ -447,7 +447,7 @@
   }
 
   void _getTags(int id, SendPort replyPort) {
-    _RegistryEntry entry = _entries[id];
+    var entry = _entries[id];
     if (entry != null) {
       replyPort.send(entry.tags.toList(growable: false));
     } else {
@@ -465,8 +465,8 @@
     }
     // Create new set, then start removing ids not also matched
     // by other tags.
-    Set<int> matchingIds = matchingFirstTagIds.toSet();
-    for (int i = 1; i < tags.length; i++) {
+    var matchingIds = matchingFirstTagIds.toSet();
+    for (var i = 1; i < tags.length; i++) {
       var tagIds = _tag2id[tags[i]];
       if (tagIds == null) return const [];
       matchingIds.retainAll(tagIds);
@@ -477,11 +477,11 @@
 
   void _find(List tags, int max, SendPort replyPort) {
     assert(max == null || max > 0);
-    List result = [];
+    var result = [];
     if (tags == null || tags.isEmpty) {
       var entries = _entries.values;
       if (max != null) entries = entries.take(max);
-      for (_RegistryEntry entry in entries) {
+      for (var entry in entries) {
         result.add(entry.id);
         result.add(entry.element);
       }
@@ -489,7 +489,7 @@
       return;
     }
     var matchingIds = _findTaggedIds(tags);
-    if (max == null) max = matchingIds.length; // All results.
+    max ??= matchingIds.length; // All results.
     for (var id in matchingIds) {
       result.add(id);
       result.add(_entries[id].element);
diff --git a/lib/runner.dart b/lib/runner.dart
index e19cb03..755437d 100644
--- a/lib/runner.dart
+++ b/lib/runner.dart
@@ -6,7 +6,7 @@
 /// or even isolate.
 library isolate.runner;
 
-import "dart:async" show Future, FutureOr;
+import 'dart:async' show Future, FutureOr;
 
 /// Calls a function with an argument.
 ///
@@ -35,9 +35,9 @@
   /// complete with a [TimeoutException].
   ///
   /// The default implementation runs the function in the current isolate.
-  Future<R> run<R, P>(FutureOr<R> function(P argument), P argument,
-      {Duration timeout, FutureOr<R> onTimeout()}) {
-    Future result = Future.sync(() => function(argument));
+  Future<R> run<R, P>(FutureOr<R> Function(P argument) function, P argument,
+      {Duration timeout, FutureOr<R> Function() onTimeout}) {
+    var result = Future.sync(() => function(argument));
     if (timeout != null) {
       result = result.timeout(timeout, onTimeout: onTimeout);
     }
diff --git a/lib/src/errors.dart b/lib/src/errors.dart
index ec938b8..38316e7 100644
--- a/lib/src/errors.dart
+++ b/lib/src/errors.dart
@@ -10,7 +10,7 @@
 /// that it returns all the errors.
 library isolate.errors;
 
-import "dart:async";
+import 'dart:async';
 
 class MultiError extends Error {
   // Limits the number of lines included from each error's error message.
@@ -41,11 +41,11 @@
   /// The order of values is not preserved (if that is needed, use
   /// [wait]).
   static Future<List<Object>> waitUnordered<T>(Iterable<Future<T>> futures,
-      {void cleanUp(T successResult)}) {
+      {void Function(T successResult) cleanUp}) {
     Completer<List<Object>> completer;
-    int count = 0;
-    int errors = 0;
-    int values = 0;
+    var count = 0;
+    var errors = 0;
+    var values = 0;
     // Initialized to `new List(count)` when count is known.
     // Filled up with values on the left, errors on the right.
     // Order is not preserved.
@@ -72,7 +72,7 @@
     };
     var handleError = (e, s) {
       if (errors == 0 && cleanUp != null) {
-        for (int i = 0; i < values; i++) {
+        for (var i = 0; i < values; i++) {
           var value = results[i];
           if (value != null) Future.sync(() => cleanUp(value));
         }
@@ -100,11 +100,11 @@
   /// [MultiError.errors] list will have errors in the corresponding slots,
   /// and `null` for non-errors.
   Future<List<Object>> wait<T>(Iterable<Future<T>> futures,
-      {void cleanUp(T successResult)}) {
+      {void Function(T successResult) cleanUp}) {
     Completer<List<Object>> completer;
-    int count = 0;
-    bool hasError = false;
-    int completed = 0;
+    var count = 0;
+    var hasError = false;
+    var completed = 0;
     // Initialized to `new List(count)` when count is known.
     // Filled with values until the first error, then cleared
     // and filled with errors.
@@ -120,7 +120,7 @@
     }
 
     for (var future in futures) {
-      int i = count;
+      var i = count;
       count++;
       future.then((v) {
         if (!hasError) {
@@ -132,7 +132,7 @@
       }, onError: (e, s) {
         if (!hasError) {
           if (cleanUp != null) {
-            for (int i = 0; i < results.length; i++) {
+            for (var i = 0; i < results.length; i++) {
               var result = results[i];
               if (result != null) Future.sync(() => cleanUp(result));
             }
@@ -150,30 +150,31 @@
     return completer.future;
   }
 
+  @override
   String toString() {
-    StringBuffer buffer = StringBuffer();
-    buffer.write("Multiple Errors:\n");
-    int linesPerError = _maxLines ~/ errors.length;
+    var buffer = StringBuffer();
+    buffer.write('Multiple Errors:\n');
+    var linesPerError = _maxLines ~/ errors.length;
     if (linesPerError < _minLinesPerError) {
       linesPerError = _minLinesPerError;
     }
 
-    for (int index = 0; index < errors.length; index++) {
+    for (var index = 0; index < errors.length; index++) {
       var error = errors[index];
       if (error == null) continue;
-      String errorString = error.toString();
-      int end = 0;
-      for (int i = 0; i < linesPerError; i++) {
+      var errorString = error.toString();
+      var end = 0;
+      for (var i = 0; i < linesPerError; i++) {
         end = errorString.indexOf('\n', end) + 1;
         if (end == 0) {
           end = errorString.length;
           break;
         }
       }
-      buffer.write("#$index: ");
+      buffer.write('#$index: ');
       buffer.write(errorString.substring(0, end));
       if (end < errorString.length) {
-        buffer.write("...\n");
+        buffer.write('...\n');
       }
     }
     return buffer.toString();
diff --git a/lib/src/raw_receive_port_multiplexer.dart b/lib/src/raw_receive_port_multiplexer.dart
index 6392424..3db8b01 100644
--- a/lib/src/raw_receive_port_multiplexer.dart
+++ b/lib/src/raw_receive_port_multiplexer.dart
@@ -23,10 +23,10 @@
 /// global mutex, so it may be a bottleneck, but it's not clear how slow it is).
 library isolate.raw_receive_port_multiplexer;
 
-import "dart:collection";
-import "dart:isolate";
+import 'dart:collection';
+import 'dart:isolate';
 
-import "util.dart";
+import 'util.dart';
 
 class _MultiplexRawReceivePort implements RawReceivePort {
   final RawReceivePortMultiplexer _multiplexer;
@@ -35,14 +35,17 @@
 
   _MultiplexRawReceivePort(this._multiplexer, this._id, this._handler);
 
+  @override
   set handler(Function handler) {
-    this._handler = handler;
+    _handler = handler;
   }
 
+  @override
   void close() {
     _multiplexer._closePort(_id);
   }
 
+  @override
   SendPort get sendPort => _multiplexer._createSendPort(_id);
 
   void _invokeHandler(message) {
@@ -55,6 +58,7 @@
   final int _id;
   _MultiplexSendPort(this._id, this._sendPort);
 
+  @override
   void send(message) {
     _sendPort.send(list2(_id, message));
   }
@@ -71,8 +75,8 @@
     _port.handler = _multiplexResponse;
   }
 
-  RawReceivePort createRawReceivePort([void handler(value)]) {
-    int id = _nextId++;
+  RawReceivePort createRawReceivePort([void Function(dynamic) handler]) {
+    var id = _nextId++;
     var result = _MultiplexRawReceivePort(this, id, handler);
     _map[id] = result;
     return result;
@@ -85,7 +89,7 @@
   void _multiplexResponse(list) {
     int id = list[0];
     var message = list[1];
-    _MultiplexRawReceivePort receivePort = _map[id];
+    var receivePort = _map[id];
     // If the receive port is closed, messages are dropped, just as for
     // the normal ReceivePort.
     if (receivePort == null) return; // Port closed.
diff --git a/test/isolaterunner_test.dart b/test/isolaterunner_test.dart
index 8917bdd..97c38d3 100644
--- a/test/isolaterunner_test.dart
+++ b/test/isolaterunner_test.dart
@@ -4,19 +4,19 @@
 
 library isolate.test.isolaterunner_test;
 
-import "dart:async" show Future;
-import "dart:isolate" show Capability;
+import 'dart:async' show Future;
+import 'dart:isolate' show Capability;
 
-import "package:isolate/isolate_runner.dart";
-import "package:test/test.dart";
+import 'package:isolate/isolate_runner.dart';
+import 'package:test/test.dart';
 
 const _ms = Duration(milliseconds: 1);
 
 void main() {
-  test("create-close", testCreateClose);
-  test("create-run-close", testCreateRunClose);
-  test("separate-isolates", testSeparateIsolates);
-  group("isolate functions", testIsolateFunctions);
+  test('create-close', testCreateClose);
+  test('create-run-close', testCreateRunClose);
+  test('separate-isolates', testSeparateIsolates);
+  group('isolate functions', testIsolateFunctions);
 }
 
 Future testCreateClose() {
@@ -27,8 +27,8 @@
 
 Future testCreateRunClose() {
   return IsolateRunner.spawn().then((IsolateRunner runner) {
-    return runner.run(id, "testCreateRunClose").then((v) {
-      expect(v, "testCreateRunClose");
+    return runner.run(id, 'testCreateRunClose').then((v) {
+      expect(v, 'testCreateRunClose');
       return runner.close().then((_) => runner.onExit);
     });
   });
@@ -38,7 +38,7 @@
   // Check that each isolate has its own _global variable.
   return Future.wait(Iterable.generate(2, (_) => IsolateRunner.spawn()))
       .then((runners) {
-    Future runAll(action(IsolateRunner runner, int index)) {
+    Future runAll(Function(IsolateRunner runner, int index) action) {
       var indices = Iterable.generate(runners.length);
       return Future.wait(indices.map((i) => action(runners[i], i)));
     }
@@ -56,8 +56,8 @@
 }
 
 void testIsolateFunctions() {
-  test("pause", () {
-    bool mayComplete = false;
+  test('pause', () {
+    var mayComplete = false;
     return IsolateRunner.spawn().then((isolate) {
       isolate.pause();
       Future.delayed(_ms * 500, () {
@@ -70,10 +70,10 @@
       }).whenComplete(isolate.close);
     });
   });
-  test("pause2", () {
-    Capability c1 = Capability();
-    Capability c2 = Capability();
-    int mayCompleteCount = 2;
+  test('pause2', () {
+    var c1 = Capability();
+    var c2 = Capability();
+    var mayCompleteCount = 2;
     return IsolateRunner.spawn().then((isolate) {
       isolate.pause(c1);
       isolate.pause(c2);
@@ -91,7 +91,7 @@
       }).whenComplete(isolate.close);
     });
   });
-  test("ping", () {
+  test('ping', () {
     return IsolateRunner.spawn().then((isolate) {
       return isolate.ping().then((v) {
         expect(v, isTrue);
@@ -99,15 +99,15 @@
       });
     });
   });
-  test("kill", () {
+  test('kill', () {
     return IsolateRunner.spawn().then((isolate) {
       return isolate.kill();
     });
   });
 }
 
-id(x) => x;
+dynamic id(x) => x;
 
 var _global;
-getGlobal(_) => _global;
-setGlobal(v) => _global = v;
+dynamic getGlobal(_) => _global;
+void setGlobal(v) => _global = v;
diff --git a/test/ports_test.dart b/test/ports_test.dart
index 0baf791..bc133c4 100644
--- a/test/ports_test.dart
+++ b/test/ports_test.dart
@@ -4,61 +4,61 @@
 
 library isolate.test.ports_test;
 
-import "dart:async";
-import "dart:isolate";
+import 'dart:async';
+import 'dart:isolate';
 
-import "package:isolate/ports.dart";
-import "package:test/test.dart";
+import 'package:isolate/ports.dart';
+import 'package:test/test.dart';
 
 const Duration _ms = Duration(milliseconds: 1);
 
-main() {
-  group("SingleCallbackPort", testSingleCallbackPort);
-  group("SingleCompletePort", testSingleCompletePort);
-  group("SingleResponseFuture", testSingleResponseFuture);
-  group("SingleResponseFuture", testSingleResultFuture);
-  group("SingleResponseChannel", testSingleResponseChannel);
+void main() {
+  group('SingleCallbackPort', testSingleCallbackPort);
+  group('SingleCompletePort', testSingleCompletePort);
+  group('SingleResponseFuture', testSingleResponseFuture);
+  group('SingleResponseFuture', testSingleResultFuture);
+  group('SingleResponseChannel', testSingleResponseChannel);
 }
 
 void testSingleCallbackPort() {
-  test("Value", () {
-    Completer completer = Completer.sync();
-    SendPort p = singleCallbackPort(completer.complete);
+  test('Value', () {
+    var completer = Completer.sync();
+    var p = singleCallbackPort(completer.complete);
     p.send(42);
     return completer.future.then((v) {
       expect(v, 42);
     });
   });
 
-  test("FirstValue", () {
-    Completer completer = Completer.sync();
-    SendPort p = singleCallbackPort(completer.complete);
+  test('FirstValue', () {
+    var completer = Completer.sync();
+    var p = singleCallbackPort(completer.complete);
     p.send(42);
     p.send(37);
     return completer.future.then((v) {
       expect(v, 42);
     });
   });
-  test("Value", () {
-    Completer completer = Completer.sync();
-    SendPort p = singleCallbackPort(completer.complete);
+  test('Value', () {
+    var completer = Completer.sync();
+    var p = singleCallbackPort(completer.complete);
     p.send(42);
     return completer.future.then((v) {
       expect(v, 42);
     });
   });
 
-  test("ValueBeforeTimeout", () {
-    Completer completer = Completer.sync();
-    SendPort p = singleCallbackPort(completer.complete, timeout: _ms * 500);
+  test('ValueBeforeTimeout', () {
+    var completer = Completer.sync();
+    var p = singleCallbackPort(completer.complete, timeout: _ms * 500);
     p.send(42);
     return completer.future.then((v) {
       expect(v, 42);
     });
   });
 
-  test("Timeout", () {
-    Completer completer = Completer.sync();
+  test('Timeout', () {
+    var completer = Completer.sync();
     singleCallbackPort(completer.complete,
         timeout: _ms * 100, timeoutValue: 37);
     return completer.future.then((v) {
@@ -66,9 +66,9 @@
     });
   });
 
-  test("TimeoutFirst", () {
-    Completer completer = Completer.sync();
-    SendPort p = singleCallbackPort(completer.complete,
+  test('TimeoutFirst', () {
+    var completer = Completer.sync();
+    var p = singleCallbackPort(completer.complete,
         timeout: _ms * 100, timeoutValue: 37);
     Timer(_ms * 500, () => p.send(42));
     return completer.future.then((v) {
@@ -78,18 +78,18 @@
 }
 
 void testSingleCompletePort() {
-  test("Value", () {
-    Completer completer = Completer.sync();
-    SendPort p = singleCompletePort(completer);
+  test('Value', () {
+    var completer = Completer.sync();
+    var p = singleCompletePort(completer);
     p.send(42);
     return completer.future.then((v) {
       expect(v, 42);
     });
   });
 
-  test("ValueCallback", () {
-    Completer completer = Completer.sync();
-    SendPort p = singleCompletePort(completer, callback: (v) {
+  test('ValueCallback', () {
+    var completer = Completer.sync();
+    var p = singleCompletePort(completer, callback: (v) {
       expect(42, v);
       return 87;
     });
@@ -99,9 +99,9 @@
     });
   });
 
-  test("ValueCallbackFuture", () {
-    Completer completer = Completer.sync();
-    SendPort p = singleCompletePort(completer, callback: (v) {
+  test('ValueCallbackFuture', () {
+    var completer = Completer.sync();
+    var p = singleCompletePort(completer, callback: (v) {
       expect(42, v);
       return Future.delayed(_ms * 500, () => 88);
     });
@@ -111,37 +111,37 @@
     });
   });
 
-  test("ValueCallbackThrows", () {
-    Completer completer = Completer.sync();
-    SendPort p = singleCompletePort(completer, callback: (v) {
+  test('ValueCallbackThrows', () {
+    var completer = Completer.sync();
+    var p = singleCompletePort(completer, callback: (v) {
       expect(42, v);
       throw 89;
     });
     p.send(42);
     return completer.future.then((v) {
-      fail("unreachable");
+      fail('unreachable');
     }, onError: (e, s) {
       expect(e, 89);
     });
   });
 
-  test("ValueCallbackThrowsFuture", () {
-    Completer completer = Completer.sync();
-    SendPort p = singleCompletePort(completer, callback: (v) {
+  test('ValueCallbackThrowsFuture', () {
+    var completer = Completer.sync();
+    var p = singleCompletePort(completer, callback: (v) {
       expect(42, v);
       return Future.error(90);
     });
     p.send(42);
     return completer.future.then((v) {
-      fail("unreachable");
+      fail('unreachable');
     }, onError: (e, s) {
       expect(e, 90);
     });
   });
 
-  test("FirstValue", () {
-    Completer completer = Completer.sync();
-    SendPort p = singleCompletePort(completer);
+  test('FirstValue', () {
+    var completer = Completer.sync();
+    var p = singleCompletePort(completer);
     p.send(42);
     p.send(37);
     return completer.future.then((v) {
@@ -149,9 +149,9 @@
     });
   });
 
-  test("FirstValueCallback", () {
-    Completer completer = Completer.sync();
-    SendPort p = singleCompletePort(completer, callback: (v) {
+  test('FirstValueCallback', () {
+    var completer = Completer.sync();
+    var p = singleCompletePort(completer, callback: (v) {
       expect(v, 42);
       return 87;
     });
@@ -162,46 +162,46 @@
     });
   });
 
-  test("ValueBeforeTimeout", () {
-    Completer completer = Completer.sync();
-    SendPort p = singleCompletePort(completer, timeout: _ms * 500);
+  test('ValueBeforeTimeout', () {
+    var completer = Completer.sync();
+    var p = singleCompletePort(completer, timeout: _ms * 500);
     p.send(42);
     return completer.future.then((v) {
       expect(v, 42);
     });
   });
 
-  test("Timeout", () {
-    Completer completer = Completer.sync();
+  test('Timeout', () {
+    var completer = Completer.sync();
     singleCompletePort(completer, timeout: _ms * 100);
     return completer.future.then((v) {
-      fail("unreachable");
+      fail('unreachable');
     }, onError: (e, s) {
       expect(e is TimeoutException, isTrue);
     });
   });
 
-  test("TimeoutCallback", () {
-    Completer completer = Completer.sync();
+  test('TimeoutCallback', () {
+    var completer = Completer.sync();
     singleCompletePort(completer, timeout: _ms * 100, onTimeout: () => 87);
     return completer.future.then((v) {
       expect(v, 87);
     });
   });
 
-  test("TimeoutCallbackThrows", () {
-    Completer completer = Completer.sync();
+  test('TimeoutCallbackThrows', () {
+    var completer = Completer.sync();
     singleCompletePort(completer,
         timeout: _ms * 100, onTimeout: () => throw 91);
     return completer.future.then((v) {
-      fail("unreachable");
+      fail('unreachable');
     }, onError: (e, s) {
       expect(e, 91);
     });
   });
 
-  test("TimeoutCallbackFuture", () {
-    Completer completer = Completer.sync();
+  test('TimeoutCallbackFuture', () {
+    var completer = Completer.sync();
     singleCompletePort(completer,
         timeout: _ms * 100, onTimeout: () => Future.value(87));
     return completer.future.then((v) {
@@ -209,19 +209,19 @@
     });
   });
 
-  test("TimeoutCallbackThrowsFuture", () {
-    Completer completer = Completer.sync();
+  test('TimeoutCallbackThrowsFuture', () {
+    var completer = Completer.sync();
     singleCompletePort(completer,
         timeout: _ms * 100, onTimeout: () => Future.error(92));
     return completer.future.then((v) {
-      fail("unreachable");
+      fail('unreachable');
     }, onError: (e, s) {
       expect(e, 92);
     });
   });
 
-  test("TimeoutCallbackSLow", () {
-    Completer completer = Completer.sync();
+  test('TimeoutCallbackSLow', () {
+    var completer = Completer.sync();
     singleCompletePort(completer,
         timeout: _ms * 100,
         onTimeout: () => Future.delayed(_ms * 500, () => 87));
@@ -230,21 +230,21 @@
     });
   });
 
-  test("TimeoutCallbackThrowsSlow", () {
-    Completer completer = Completer.sync();
+  test('TimeoutCallbackThrowsSlow', () {
+    var completer = Completer.sync();
     singleCompletePort(completer,
         timeout: _ms * 100,
         onTimeout: () => Future.delayed(_ms * 500, () => throw 87));
     return completer.future.then((v) {
-      fail("unreachable");
+      fail('unreachable');
     }, onError: (e, s) {
       expect(e, 87);
     });
   });
 
-  test("TimeoutFirst", () {
-    Completer completer = Completer.sync();
-    SendPort p =
+  test('TimeoutFirst', () {
+    var completer = Completer.sync();
+    var p =
         singleCompletePort(completer, timeout: _ms * 100, onTimeout: () => 37);
     Timer(_ms * 500, () => p.send(42));
     return completer.future.then((v) {
@@ -254,7 +254,7 @@
 }
 
 void testSingleResponseFuture() {
-  test("FutureValue", () {
+  test('FutureValue', () {
     return singleResponseFuture((SendPort p) {
       p.send(42);
     }).then((v) {
@@ -262,7 +262,7 @@
     });
   });
 
-  test("FutureValueFirst", () {
+  test('FutureValueFirst', () {
     return singleResponseFuture((SendPort p) {
       p.send(42);
       p.send(37);
@@ -271,17 +271,17 @@
     });
   });
 
-  test("FutureError", () {
+  test('FutureError', () {
     return singleResponseFuture((SendPort p) {
       throw 93;
     }).then((v) {
-      fail("unreachable");
+      fail('unreachable');
     }, onError: (e, s) {
       expect(e, 93);
     });
   });
 
-  test("FutureTimeout", () {
+  test('FutureTimeout', () {
     return singleResponseFuture((SendPort p) {
       // no-op.
     }, timeout: _ms * 100)
@@ -290,7 +290,7 @@
     });
   });
 
-  test("FutureTimeoutValue", () {
+  test('FutureTimeoutValue', () {
     return singleResponseFuture((SendPort p) {
       // no-op.
     }, timeout: _ms * 100, timeoutValue: 42)
@@ -301,7 +301,7 @@
 }
 
 void testSingleResultFuture() {
-  test("Value", () {
+  test('Value', () {
     return singleResultFuture((SendPort p) {
       sendFutureResult(Future.value(42), p);
     }).then((v) {
@@ -309,7 +309,7 @@
     });
   });
 
-  test("ValueFirst", () {
+  test('ValueFirst', () {
     return singleResultFuture((SendPort p) {
       sendFutureResult(Future.value(42), p);
       sendFutureResult(Future.value(37), p);
@@ -318,49 +318,49 @@
     });
   });
 
-  test("Error", () {
+  test('Error', () {
     return singleResultFuture((SendPort p) {
       sendFutureResult(Future.error(94), p);
     }).then((v) {
-      fail("unreachable");
+      fail('unreachable');
     }, onError: (e, s) {
       expect(e is RemoteError, isTrue);
     });
   });
 
-  test("ErrorFirst", () {
+  test('ErrorFirst', () {
     return singleResultFuture((SendPort p) {
       sendFutureResult(Future.error(95), p);
       sendFutureResult(Future.error(96), p);
     }).then((v) {
-      fail("unreachable");
+      fail('unreachable');
     }, onError: (e, s) {
       expect(e is RemoteError, isTrue);
     });
   });
 
-  test("Error", () {
+  test('Error', () {
     return singleResultFuture((SendPort p) {
       throw 93;
     }).then((v) {
-      fail("unreachable");
+      fail('unreachable');
     }, onError: (e, s) {
       expect(e is RemoteError, isTrue);
     });
   });
 
-  test("Timeout", () {
+  test('Timeout', () {
     return singleResultFuture((SendPort p) {
       // no-op.
     }, timeout: _ms * 100)
         .then((v) {
-      fail("unreachable");
+      fail('unreachable');
     }, onError: (e, s) {
       expect(e is TimeoutException, isTrue);
     });
   });
 
-  test("TimeoutValue", () {
+  test('TimeoutValue', () {
     return singleResultFuture((SendPort p) {
       // no-op.
     }, timeout: _ms * 100, onTimeout: () => 42).then((v) {
@@ -368,7 +368,7 @@
     });
   });
 
-  test("TimeoutError", () {
+  test('TimeoutError', () {
     return singleResultFuture((SendPort p) {
       // no-op.
     }, timeout: _ms * 100, onTimeout: () => throw 97).then((v) {
@@ -380,7 +380,7 @@
 }
 
 void testSingleResponseChannel() {
-  test("Value", () {
+  test('Value', () {
     var channel = SingleResponseChannel();
     channel.port.send(42);
     return channel.result.then((v) {
@@ -388,7 +388,7 @@
     });
   });
 
-  test("ValueFirst", () {
+  test('ValueFirst', () {
     var channel = SingleResponseChannel();
     channel.port.send(42);
     channel.port.send(37);
@@ -397,7 +397,7 @@
     });
   });
 
-  test("ValueCallback", () {
+  test('ValueCallback', () {
     var channel = SingleResponseChannel(callback: (v) => 2 * v);
     channel.port.send(42);
     return channel.result.then((v) {
@@ -405,17 +405,17 @@
     });
   });
 
-  test("ErrorCallback", () {
+  test('ErrorCallback', () {
     var channel = SingleResponseChannel(callback: (v) => throw 42);
     channel.port.send(37);
     return channel.result.then((v) {
-      fail("unreachable");
+      fail('unreachable');
     }, onError: (v, s) {
       expect(v, 42);
     });
   });
 
-  test("AsyncValueCallback", () {
+  test('AsyncValueCallback', () {
     var channel = SingleResponseChannel(callback: (v) => Future.value(2 * v));
     channel.port.send(42);
     return channel.result.then((v) {
@@ -423,47 +423,47 @@
     });
   });
 
-  test("AsyncErrorCallback", () {
+  test('AsyncErrorCallback', () {
     var channel = SingleResponseChannel(callback: (v) => Future.error(42));
     channel.port.send(37);
     return channel.result.then((v) {
-      fail("unreachable");
+      fail('unreachable');
     }, onError: (v, s) {
       expect(v, 42);
     });
   });
 
-  test("Timeout", () {
+  test('Timeout', () {
     var channel = SingleResponseChannel(timeout: _ms * 100);
     return channel.result.then((v) {
       expect(v, null);
     });
   });
 
-  test("TimeoutThrow", () {
+  test('TimeoutThrow', () {
     var channel =
         SingleResponseChannel(timeout: _ms * 100, throwOnTimeout: true);
     return channel.result.then((v) {
-      fail("unreachable");
+      fail('unreachable');
     }, onError: (v, s) {
       expect(v is TimeoutException, isTrue);
     });
   });
 
-  test("TimeoutThrowOnTimeoutAndValue", () {
+  test('TimeoutThrowOnTimeoutAndValue', () {
     var channel = SingleResponseChannel(
         timeout: _ms * 100,
         throwOnTimeout: true,
         onTimeout: () => 42,
         timeoutValue: 42);
     return channel.result.then((v) {
-      fail("unreachable");
+      fail('unreachable');
     }, onError: (v, s) {
       expect(v is TimeoutException, isTrue);
     });
   });
 
-  test("TimeoutOnTimeout", () {
+  test('TimeoutOnTimeout', () {
     var channel =
         SingleResponseChannel(timeout: _ms * 100, onTimeout: () => 42);
     return channel.result.then((v) {
@@ -471,7 +471,7 @@
     });
   });
 
-  test("TimeoutOnTimeoutAndValue", () {
+  test('TimeoutOnTimeoutAndValue', () {
     var channel = SingleResponseChannel(
         timeout: _ms * 100, onTimeout: () => 42, timeoutValue: 37);
     return channel.result.then((v) {
@@ -479,24 +479,24 @@
     });
   });
 
-  test("TimeoutValue", () {
+  test('TimeoutValue', () {
     var channel = SingleResponseChannel(timeout: _ms * 100, timeoutValue: 42);
     return channel.result.then((v) {
       expect(v, 42);
     });
   });
 
-  test("TimeoutOnTimeoutError", () {
+  test('TimeoutOnTimeoutError', () {
     var channel =
         SingleResponseChannel(timeout: _ms * 100, onTimeout: () => throw 42);
     return channel.result.then((v) {
-      fail("unreachable");
+      fail('unreachable');
     }, onError: (v, s) {
       expect(v, 42);
     });
   });
 
-  test("TimeoutOnTimeoutAsync", () {
+  test('TimeoutOnTimeoutAsync', () {
     var channel = SingleResponseChannel(
         timeout: _ms * 100, onTimeout: () => Future.value(42));
     return channel.result.then((v) {
@@ -504,11 +504,11 @@
     });
   });
 
-  test("TimeoutOnTimeoutAsyncError", () {
+  test('TimeoutOnTimeoutAsyncError', () {
     var channel = SingleResponseChannel(
         timeout: _ms * 100, onTimeout: () => Future.error(42));
     return channel.result.then((v) {
-      fail("unreachable");
+      fail('unreachable');
     }, onError: (v, s) {
       expect(v, 42);
     });
diff --git a/test/registry_test.dart b/test/registry_test.dart
index 5cb5ce1..9e3cdec 100644
--- a/test/registry_test.dart
+++ b/test/registry_test.dart
@@ -4,25 +4,25 @@
 
 library isolate.test.registry_test;
 
-import "dart:async";
-import "dart:isolate";
+import 'dart:async';
+import 'dart:isolate';
 
-import "package:isolate/isolate_runner.dart";
-import "package:isolate/registry.dart";
+import 'package:isolate/isolate_runner.dart';
+import 'package:isolate/registry.dart';
 
-import "package:test/test.dart";
+import 'package:test/test.dart';
 
 const _ms = Duration(milliseconds: 1);
 
 void main() {
-  group("lookup", testLookup);
-  group("AddLookup", testAddLookup);
-  group("AddRemoveTags", testAddRemoveTags);
-  group("Remove", testRemove);
-  group("CrossIsolate", testCrossIsolate);
-  group("Timeout", testTimeout);
-  group("MultiRegistry", testMultiRegistry);
-  group("ObjectsAndTags", testObjectsAndTags);
+  group('lookup', testLookup);
+  group('AddLookup', testAddLookup);
+  group('AddRemoveTags', testAddRemoveTags);
+  group('Remove', testRemove);
+  group('CrossIsolate', testCrossIsolate);
+  group('Timeout', testTimeout);
+  group('MultiRegistry', testMultiRegistry);
+  group('ObjectsAndTags', testObjectsAndTags);
 }
 
 abstract class Oddity {
@@ -30,14 +30,14 @@
   static const int odd = 1;
 }
 
-Future<List> waitAll(int n, Future action(int n)) {
+Future<List> waitAll(int n, Future Function(int n) action) {
   return Future.wait(Iterable.generate(n, action));
 }
 
 void testLookup() {
-  test("All", () {
-    RegistryManager regman = RegistryManager();
-    Registry registry = regman.registry;
+  test('All', () {
+    var regman = RegistryManager();
+    var registry = regman.registry;
     return waitAll(10, (i) {
       var element = Element(i);
       var tag = i.isEven ? Oddity.even : Oddity.odd;
@@ -51,9 +51,9 @@
     }).whenComplete(regman.close);
   });
 
-  test("Odd", () {
-    RegistryManager regman = RegistryManager();
-    Registry registry = regman.registry;
+  test('Odd', () {
+    var regman = RegistryManager();
+    var registry = regman.registry;
     return waitAll(10, (i) {
       var element = Element(i);
       var tag = i.isEven ? Oddity.even : Oddity.odd;
@@ -66,9 +66,9 @@
     }).whenComplete(regman.close);
   });
 
-  test("Max", () {
-    RegistryManager regman = RegistryManager();
-    Registry registry = regman.registry;
+  test('Max', () {
+    var regman = RegistryManager();
+    var registry = regman.registry;
     return waitAll(10, (i) {
       var element = Element(i);
       var tag = i.isEven ? Oddity.even : Oddity.odd;
@@ -80,14 +80,14 @@
     }).whenComplete(regman.close);
   });
 
-  test("MultiTag", () {
-    RegistryManager regman = RegistryManager();
-    Registry registry = regman.registry;
+  test('MultiTag', () {
+    var regman = RegistryManager();
+    var registry = regman.registry;
     return waitAll(25, (i) {
       var element = Element(i);
       // Collect all numbers dividing i.
       var tags = [i];
-      for (int j = 2; j < 25; j++) {
+      for (var j = 2; j < 25; j++) {
         if (i % j == 0) tags.add(j);
       }
       return registry.add(element, tags: tags);
@@ -99,14 +99,14 @@
     }).whenComplete(regman.close);
   });
 
-  test("MultiTagMax", () {
-    RegistryManager regman = RegistryManager();
-    Registry registry = regman.registry;
+  test('MultiTagMax', () {
+    var regman = RegistryManager();
+    var registry = regman.registry;
     return waitAll(25, (i) {
       var element = Element(i);
       // Collect all numbers dividing i.
       var tags = [i];
-      for (int j = 2; j < 25; j++) {
+      for (var j = 2; j < 25; j++) {
         if (i % j == 0) tags.add(j);
       }
       return registry.add(element, tags: tags);
@@ -120,9 +120,9 @@
 }
 
 void testAddLookup() {
-  test("Add-lookup-identical", () {
-    RegistryManager regman = RegistryManager();
-    Registry registry = regman.registry;
+  test('Add-lookup-identical', () {
+    var regman = RegistryManager();
+    var registry = regman.registry;
     var object = Object();
     return registry.add(object).then((_) {
       return registry.lookup();
@@ -132,9 +132,9 @@
     }).whenComplete(regman.close);
   });
 
-  test("Add-multiple-identical", () {
-    RegistryManager regman = RegistryManager();
-    Registry registry = regman.registry;
+  test('Add-multiple-identical', () {
+    var regman = RegistryManager();
+    var registry = regman.registry;
     var object1 = Object();
     var object2 = Object();
     var object3 = Object();
@@ -149,22 +149,22 @@
     }).whenComplete(regman.close);
   });
 
-  test("Add-twice", () {
-    RegistryManager regman = RegistryManager();
-    Registry registry = regman.registry;
+  test('Add-twice', () {
+    var regman = RegistryManager();
+    var registry = regman.registry;
     var object = Object();
     return registry.add(object).then((_) {
       return registry.add(object);
     }).then((_) {
-      fail("Unreachable");
+      fail('Unreachable');
     }, onError: (e, s) {
       expect(e, isStateError);
     }).whenComplete(regman.close);
   });
 
-  test("Add-lookup-add-lookup", () {
-    RegistryManager regman = RegistryManager();
-    Registry registry = regman.registry;
+  test('Add-lookup-add-lookup', () {
+    var regman = RegistryManager();
+    var registry = regman.registry;
     var object = Object();
     var object2 = Object();
     return registry.add(object).then((_) {
@@ -187,9 +187,9 @@
     }).whenComplete(regman.close);
   });
 
-  test("lookup-add-lookup", () {
-    RegistryManager regman = RegistryManager();
-    Registry registry = regman.registry;
+  test('lookup-add-lookup', () {
+    var regman = RegistryManager();
+    var registry = regman.registry;
     var object = Object();
     return registry.lookup().then((entries) {
       expect(entries, isEmpty);
@@ -202,9 +202,9 @@
     }).whenComplete(regman.close);
   });
 
-  test("Add-multiple-tags", () {
-    RegistryManager regman = RegistryManager();
-    Registry registry = regman.registry;
+  test('Add-multiple-tags', () {
+    var regman = RegistryManager();
+    var registry = regman.registry;
     var object1 = Object();
     var object2 = Object();
     var object3 = Object();
@@ -233,9 +233,9 @@
 }
 
 void testRemove() {
-  test("Add-remove", () {
-    RegistryManager regman = RegistryManager();
-    Registry registry = regman.registry;
+  test('Add-remove', () {
+    var regman = RegistryManager();
+    var registry = regman.registry;
     var object = Object();
     return registry.add(object).then((removeCapability) {
       return registry.lookup().then((entries) {
@@ -251,9 +251,9 @@
     }).whenComplete(regman.close);
   });
 
-  test("Add-remove-fail", () {
-    RegistryManager regman = RegistryManager();
-    Registry registry = regman.registry;
+  test('Add-remove-fail', () {
+    var regman = RegistryManager();
+    var registry = regman.registry;
     var object = Object();
     return registry.add(object).then((removeCapability) {
       return registry.lookup().then((entries) {
@@ -268,82 +268,82 @@
 }
 
 void testAddRemoveTags() {
-  test("Add-remove-tag", () {
-    RegistryManager regman = RegistryManager();
-    Registry registry = regman.registry;
+  test('Add-remove-tag', () {
+    var regman = RegistryManager();
+    var registry = regman.registry;
     var object = Object();
     return registry.add(object).then((removeCapability) {
-      return registry.lookup(tags: ["x"]);
+      return registry.lookup(tags: ['x']);
     }).then((entries) {
       expect(entries, isEmpty);
-      return registry.addTags([object], ["x"]);
+      return registry.addTags([object], ['x']);
     }).then((_) {
-      return registry.lookup(tags: ["x"]);
+      return registry.lookup(tags: ['x']);
     }).then((entries) {
       expect(entries, hasLength(1));
       expect(entries.first, same(object));
-      return registry.removeTags([object], ["x"]);
+      return registry.removeTags([object], ['x']);
     }).then((_) {
-      return registry.lookup(tags: ["x"]);
+      return registry.lookup(tags: ['x']);
     }).then((entries) {
       expect(entries, isEmpty);
     }).whenComplete(regman.close);
   });
 
-  test("Tag-twice", () {
-    RegistryManager regman = RegistryManager();
-    Registry registry = regman.registry;
+  test('Tag-twice', () {
+    var regman = RegistryManager();
+    var registry = regman.registry;
     var object = Object();
-    return registry.add(object, tags: ["x"]).then((removeCapability) {
-      return registry.lookup(tags: ["x"]);
+    return registry.add(object, tags: ['x']).then((removeCapability) {
+      return registry.lookup(tags: ['x']);
     }).then((entries) {
       expect(entries, hasLength(1));
       expect(entries.first, same(object));
       // Adding the same tag twice is allowed, but does nothing.
-      return registry.addTags([object], ["x"]);
+      return registry.addTags([object], ['x']);
     }).then((_) {
-      return registry.lookup(tags: ["x"]);
+      return registry.lookup(tags: ['x']);
     }).then((entries) {
       expect(entries, hasLength(1));
       expect(entries.first, same(object));
       // Removing the tag once is enough to remove it.
-      return registry.removeTags([object], ["x"]);
+      return registry.removeTags([object], ['x']);
     }).then((_) {
-      return registry.lookup(tags: ["x"]);
+      return registry.lookup(tags: ['x']);
     }).then((entries) {
       expect(entries, isEmpty);
     }).whenComplete(regman.close);
   });
 
-  test("Add-remove-multiple", () {
-    RegistryManager regman = RegistryManager();
-    Registry registry = regman.registry;
+  test('Add-remove-multiple', () {
+    var regman = RegistryManager();
+    var registry = regman.registry;
     var object1 = Object();
     var object2 = Object();
     var object3 = Object();
     var objects = [object1, object2, object3];
     return Future.wait(objects.map(registry.add)).then((_) {
-      return registry.addTags([object1, object2], ["x", "y"]);
+      return registry.addTags([object1, object2], ['x', 'y']);
     }).then((_) {
-      return registry.addTags([object1, object3], ["z", "w"]);
+      return registry.addTags([object1, object3], ['z', 'w']);
     }).then((_) {
-      return registry.lookup(tags: ["x", "z"]);
+      return registry.lookup(tags: ['x', 'z']);
     }).then((entries) {
       expect(entries, hasLength(1));
       expect(entries.first, same(object1));
-      return registry.removeTags([object1, object2], ["x", "z"]);
+      return registry.removeTags([object1, object2], ['x', 'z']);
     }).then((_) {
-      return registry.lookup(tags: ["z"]);
+      return registry.lookup(tags: ['z']);
     }).then((entries) {
       expect(entries, hasLength(1));
       expect(entries.first, same(object3));
     }).whenComplete(regman.close);
   });
 
-  test("Remove-wrong-object", () {
-    RegistryManager regman = RegistryManager();
-    Registry registry = regman.registry;
-    expect(() => registry.removeTags([Object()], ["x"]), throwsStateError);
+  test('Remove-wrong-object', () {
+    var regman = RegistryManager();
+    var registry = regman.registry;
+    expect(() => registry.removeTags([Object()], ['x']), throwsStateError);
     regman.close();
   });
 }
@@ -361,12 +361,12 @@
 
 void testCrossIsolate() {
   var object = Object();
-  test("regman-other-isolate", () {
+  test('regman-other-isolate', () {
     // Add, lookup and remove object in other isolate.
     return IsolateRunner.spawn().then((isolate) {
       isolate.run(createRegMan, 1).then((registry) {
-        return registry.add(object, tags: ["a", "b"]).then((removeCapability) {
-          return registry.lookup(tags: ["a"]).then((entries) {
+        return registry.add(object, tags: ['a', 'b']).then((removeCapability) {
+          return registry.lookup(tags: ['a']).then((entries) {
             expect(entries, hasLength(1));
             expect(entries.first, same(object));
             return registry.remove(entries.first, removeCapability);
@@ -384,65 +384,65 @@
 }
 
 void testTimeout() {
-  test("Timeout-add", () {
-    RegistryManager regman = RegistryManager(timeout: _ms * 500);
-    Registry registry = regman.registry;
+  test('Timeout-add', () {
+    var regman = RegistryManager(timeout: _ms * 500);
+    var registry = regman.registry;
     regman.close();
     return registry.add(Object()).then((_) {
-      fail("unreachable");
+      fail('unreachable');
     }, onError: (e, s) {
       expect(e is TimeoutException, isTrue);
     });
   });
 
-  test("Timeout-remove", () {
-    RegistryManager regman = RegistryManager(timeout: _ms * 500);
-    Registry registry = regman.registry;
+  test('Timeout-remove', () {
+    var regman = RegistryManager(timeout: _ms * 500);
+    var registry = regman.registry;
     var object = Object();
     return registry.add(object).then((rc) {
       regman.close();
       return registry.remove(object, rc).then((_) {
-        fail("unreachable");
+        fail('unreachable');
       }, onError: (e, s) {
         expect(e is TimeoutException, isTrue);
       });
     });
   });
 
-  test("Timeout-addTags", () {
-    RegistryManager regman = RegistryManager(timeout: _ms * 500);
-    Registry registry = regman.registry;
+  test('Timeout-addTags', () {
+    var regman = RegistryManager(timeout: _ms * 500);
+    var registry = regman.registry;
     var object = Object();
     return registry.add(object).then((rc) {
       regman.close();
-      return registry.addTags([object], ["x"]).then((_) {
-        fail("unreachable");
+      return registry.addTags([object], ['x']).then((_) {
+        fail('unreachable');
       }, onError: (e, s) {
         expect(e is TimeoutException, isTrue);
       });
     });
   });
 
-  test("Timeout-removeTags", () {
-    RegistryManager regman = RegistryManager(timeout: _ms * 500);
-    Registry registry = regman.registry;
+  test('Timeout-removeTags', () {
+    var regman = RegistryManager(timeout: _ms * 500);
+    var registry = regman.registry;
     var object = Object();
     return registry.add(object).then((rc) {
       regman.close();
-      return registry.removeTags([object], ["x"]).then((_) {
-        fail("unreachable");
+      return registry.removeTags([object], ['x']).then((_) {
+        fail('unreachable');
       }, onError: (e, s) {
         expect(e is TimeoutException, isTrue);
       });
     });
   });
 
-  test("Timeout-lookup", () {
-    RegistryManager regman = RegistryManager(timeout: _ms * 500);
-    Registry registry = regman.registry;
+  test('Timeout-lookup', () {
+    var regman = RegistryManager(timeout: _ms * 500);
+    var registry = regman.registry;
     regman.close();
     registry.lookup().then((_) {
-      fail("unreachable");
+      fail('unreachable');
     }, onError: (e, s) {
       expect(e is TimeoutException, isTrue);
     });
@@ -450,13 +450,13 @@
 }
 
 void testMultiRegistry() {
-  test("dual-registry", () {
-    RegistryManager regman = RegistryManager();
-    Registry registry1 = regman.registry;
-    Registry registry2 = regman.registry;
-    var l1 = ["x"];
+  test('dual-registry', () {
+    var regman = RegistryManager();
+    var registry1 = regman.registry;
+    var registry2 = regman.registry;
+    var l1 = ['x'];
     var l2;
-    return registry1.add(l1, tags: ["y"]).then((removeCapability) {
+    return registry1.add(l1, tags: ['y']).then((removeCapability) {
       return registry2.lookup().then((entries) {
         expect(entries, hasLength(1));
         l2 = entries.first;
@@ -479,12 +479,12 @@
 }
 
 void testObjectsAndTags() {
-  testObject(object) {
-    String name = "Transfer-${object.runtimeType}";
+  void testObject(object) {
+    var name = 'Transfer-${object.runtimeType}';
     test(name, () {
-      RegistryManager regman = RegistryManager();
-      Registry registry1 = regman.registry;
-      Registry registry2 = regman.registry;
+      var regman = RegistryManager();
+      var registry1 = regman.registry;
+      var registry2 = regman.registry;
       return registry1.add(object, tags: [object]).then((removeCapability) {
         return registry2.lookup().then((entries) {
           expect(entries, hasLength(1));
@@ -514,7 +514,7 @@
   // that has an operator== that works after cloning (for use as tags).
   testObject(42);
   testObject(3.14);
-  testObject("string");
+  testObject('string');
   testObject(true);
   testObject(null);
   testObject(Element(42));
@@ -527,7 +527,9 @@
 class Element {
   final int id;
   Element(this.id);
+  @override
   int get hashCode => id;
+  @override
   bool operator ==(Object other) => other is Element && id == other.id;
 }