strong mode fixes (#11)

* strong mode fixes

* switch to Dart tasks on Travis

* Add analysis options

* make variables final that can be

* Fix some type issues
diff --git a/.travis.yml b/.travis.yml
index 02caa43..74d7d9c 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -3,4 +3,16 @@
 dart:
   - dev
   - stable
-script: ./tool/travis.sh
+
+dart_task:
+  - test
+  - dartfmt
+  - dartanalyzer
+
+# Only building master means that we don't run two builds for each pull request.
+branches:
+  only: [master]
+
+cache:
+  directories:
+    - $HOME/.pub-cache
diff --git a/analysis_options.yaml b/analysis_options.yaml
new file mode 100644
index 0000000..a10d4c5
--- /dev/null
+++ b/analysis_options.yaml
@@ -0,0 +1,2 @@
+analyzer:
+  strong-mode: true
diff --git a/example/runner_pool.dart b/example/runner_pool.dart
index ab201cd..7773a12 100644
--- a/example/runner_pool.dart
+++ b/example/runner_pool.dart
@@ -4,7 +4,7 @@
 
 library isolate.example.runner_pool;
 
-import 'dart:async' show Future, Completer;
+import 'dart:async' show Future;
 
 import 'package:isolate/load_balancer.dart';
 import 'package:isolate/isolate_runner.dart';
@@ -32,7 +32,7 @@
 Future<List<int>> parfib(int limit, int parallelity) {
   return LoadBalancer.create(parallelity, IsolateRunner.spawn).then(
     (LoadBalancer pool) {
-      List<Future> fibs = new List(limit + 1);
+      var fibs = new List<Future<int>>(limit + 1);
       // Schedule all calls with exact load value and the heaviest task
       // assigned first.
       schedule(a, b, i) {
@@ -47,12 +47,12 @@
     });
 }
 
-int computeFib(n) {
-  int result = fib(n);
+int computeFib(int n) {
+  var result = fib(n);
   return result;
 }
 
-int fib(n) {
+int fib(int n) {
   if (n < 2) return n;
   return fib(n - 1) + fib(n - 2);
 }
diff --git a/lib/load_balancer.dart b/lib/load_balancer.dart
index 3f08288..4ff066d 100644
--- a/lib/load_balancer.dart
+++ b/lib/load_balancer.dart
@@ -24,7 +24,7 @@
   int _length;
 
   // Whether [stop] has been called.
-  Future _stopFuture = null;
+  Future _stopFuture;
 
   /// Create a load balancer for [service] with [size] isolates.
   LoadBalancer(Iterable<Runner> runners) : this._(_createEntries(runners));
diff --git a/lib/registry.dart b/lib/registry.dart
index a1550b1..213acd1 100644
--- a/lib/registry.dart
+++ b/lib/registry.dart
@@ -48,7 +48,7 @@
   // The cache is stored in an [Expando], not on the object.
   // This allows sending the `Registry` object through a `SendPort` without
   // also copying the cache.
-  static Expando _caches = new Expando();
+  static final Expando _caches = new Expando();
 
   /// Port for sending command to the central registry manager.
   SendPort _commandPort;
@@ -281,15 +281,15 @@
 
   /// Maps id to entry. Each entry contains the id, the element, its tags,
   /// and a capability required to remove it again.
-  Map<int, _RegistryEntry> _entries = new HashMap();
-  Map<Object, Set<int>> _tag2id = new HashMap();
+  final Map<int, _RegistryEntry> _entries = new HashMap();
+  final Map<Object, Set<int>> _tag2id = new HashMap();
 
   /// Create a new registry managed by the created [RegistryManager].
   ///
   /// The optional [timeout] parameter can be set to the duration
   /// registry objects should wait before assuming that an operation
   /// has failed.
-  RegistryManager({timeout: const Duration(seconds: 5)})
+  RegistryManager({Duration timeout: const Duration(seconds: 5)})
       : _timeout = timeout,
         _commandPort = new RawReceivePort() {
     _commandPort.handler = _handleCommand;
diff --git a/lib/src/errors.dart b/lib/src/errors.dart
index dd3b85d..058af90 100644
--- a/lib/src/errors.dart
+++ b/lib/src/errors.dart
@@ -58,7 +58,7 @@
       }
       var errorList = results.sublist(results.length - errors);
       completer.completeError(new MultiError(errorList));
-    };
+    }
     var handleValue = (v) {
       // If this fails because [results] is null, there is a future
       // which breaks the Future API by completing immediately when
@@ -115,7 +115,7 @@
         return;
       }
       completer.completeError(new MultiError(results));
-    };
+    }
     for (Future future in futures) {
       int i = count;
       count++;
diff --git a/pubspec.yaml b/pubspec.yaml
index ae9da40..5008df0 100644
--- a/pubspec.yaml
+++ b/pubspec.yaml
@@ -1,5 +1,5 @@
 name: isolate
-version: 1.0.0
+version: 1.0.1-dev
 author: Dart Team <misc@dartlang.org>
 description: Utility functions and classes related to the 'dart:isolate' library.
 homepage: https://github.com/dart-lang/isolate
diff --git a/test/registry_test.dart b/test/registry_test.dart
index f72c057..9c1fbf5 100644
--- a/test/registry_test.dart
+++ b/test/registry_test.dart
@@ -350,7 +350,7 @@
   test("Remove-wrong-object", () {
     RegistryManager regman = new RegistryManager();
     Registry registry = regman.registry;
-    expect(() => registry.removeTags([new Object()], ["x"]), throws);
+    expect(() => registry.removeTags([new Object()], ["x"]), throwsStateError);
     regman.close();
   });
 }
diff --git a/tool/travis.sh b/tool/travis.sh
deleted file mode 100755
index ffcdf89..0000000
--- a/tool/travis.sh
+++ /dev/null
@@ -1,17 +0,0 @@
-#!/bin/bash
-
-# Fast fail the script on failures.   
-set -e
-
-# Run the tests.
-dart --checked test/test_all.dart
-
-# Install dart_coveralls; gather and send coverage data.
-if [ "$COVERALLS_TOKEN" ] && [ "$TRAVIS_DART_VERSION" = "stable" ]; then
-  pub global activate dart_coveralls
-  pub global run dart_coveralls report \
-    --token $COVERALLS_TOKEN \
-    --retry 2 \
-    --exclude-test-files \
-    test/test_all.dart
-fi
\ No newline at end of file