Fix new lints (#88)

diff --git a/lib/src/differs.dart b/lib/src/differs.dart
index 40f005e..38f85c3 100644
--- a/lib/src/differs.dart
+++ b/lib/src/differs.dart
@@ -29,7 +29,7 @@
 
   const EqualityDiffer([this._equality = const DefaultEquality()]);
 
-  const EqualityDiffer.identity() : this._equality = const IdentityEquality();
+  const EqualityDiffer.identity() : _equality = const IdentityEquality();
 
   @override
   List<ChangeRecord> diff(E oldValue, E newValue) {
diff --git a/lib/src/observable_list.dart b/lib/src/observable_list.dart
index a502771..863d0ad 100644
--- a/lib/src/observable_list.dart
+++ b/lib/src/observable_list.dart
@@ -110,15 +110,12 @@
   ///
   /// [deliverChanges] can be called to force synchronous delivery.
   Stream<List<ListChangeRecord<E>>> get listChanges {
-    if (_listChanges == null) {
-      // TODO(jmesserly): split observed/unobserved notions?
-      _listChanges = StreamController.broadcast(
-        sync: true,
-        onCancel: () {
-          _listChanges = null;
-        },
-      );
-    }
+    _listChanges ??= StreamController.broadcast(
+      sync: true,
+      onCancel: () {
+        _listChanges = null;
+      },
+    );
     return _listChanges.stream;
   }
 
@@ -129,7 +126,7 @@
 
   @override
   set length(int value) {
-    int len = _list.length;
+    var len = _list.length;
     if (len == value) return;
 
     // Produce notifications if needed
@@ -150,7 +147,7 @@
 
   @override
   void operator []=(int index, E value) {
-    E oldValue = _list[index];
+    var oldValue = _list[index];
     if (hasListObservers && oldValue != value) {
       _notifyListChange(index, addedCount: 1, removed: [oldValue]);
     }
@@ -175,7 +172,7 @@
     if (iterable is! List && iterable is! Set) {
       iterable = iterable.toList();
     }
-    int length = iterable.length;
+    var length = iterable.length;
     if (hasListObservers && length > 0) {
       _notifyListChange(index,
           addedCount: length, removed: _list.sublist(index, length));
@@ -185,7 +182,7 @@
 
   @override
   void add(E value) {
-    int len = _list.length;
+    var len = _list.length;
     _notifyChangeLength(len, len + 1);
     if (hasListObservers) {
       _notifyListChange(len, addedCount: 1);
@@ -196,12 +193,12 @@
 
   @override
   void addAll(Iterable<E> iterable) {
-    int len = _list.length;
+    var len = _list.length;
     _list.addAll(iterable);
 
     _notifyChangeLength(len, _list.length);
 
-    int added = _list.length - len;
+    var added = _list.length - len;
     if (hasListObservers && added > 0) {
       _notifyListChange(len, addedCount: added);
     }
@@ -209,7 +206,7 @@
 
   @override
   bool remove(Object element) {
-    for (int i = 0; i < this.length; i++) {
+    for (var i = 0; i < length; i++) {
       if (this[i] == element) {
         removeRange(i, i + 1);
         return true;
@@ -221,8 +218,8 @@
   @override
   void removeRange(int start, int end) {
     _rangeCheck(start, end);
-    int rangeLength = end - start;
-    int len = _list.length;
+    var rangeLength = end - start;
+    var len = _list.length;
 
     _notifyChangeLength(len, len - rangeLength);
     if (hasListObservers && rangeLength > 0) {
@@ -241,14 +238,14 @@
     if (iterable is! List && iterable is! Set) {
       iterable = iterable.toList();
     }
-    int insertionLength = iterable.length;
+    var insertionLength = iterable.length;
     // There might be errors after the length change, in which case the list
     // will end up being modified but the operation not complete. Unless we
     // always go through a "toList" we can't really avoid that.
-    int len = _list.length;
+    var len = _list.length;
     _list.length += insertionLength;
 
-    _list.setRange(index + insertionLength, this.length, this, index);
+    _list.setRange(index + insertionLength, length, this, index);
     _list.setAll(index, iterable);
 
     _notifyChangeLength(len, _list.length);
@@ -283,17 +280,17 @@
 
   @override
   E removeAt(int index) {
-    E result = this[index];
+    var result = this[index];
     removeRange(index, index + 1);
     return result;
   }
 
   void _rangeCheck(int start, int end) {
-    if (start < 0 || start > this.length) {
-      throw RangeError.range(start, 0, this.length);
+    if (start < 0 || start > length) {
+      throw RangeError.range(start, 0, length);
     }
-    if (end < start || end > this.length) {
-      throw RangeError.range(end, start, this.length);
+    if (end < start || end > length) {
+      throw RangeError.range(end, start, length);
     }
   }
 
@@ -365,9 +362,9 @@
       throw ArgumentError("can't use same list for previous and current");
     }
 
-    for (ListChangeRecord change in changeRecords) {
-      int addEnd = change.index + change.addedCount;
-      int removeEnd = change.index + change.removed.length;
+    for (var change in changeRecords) {
+      var addEnd = change.index + change.addedCount;
+      var removeEnd = change.index + change.removed.length;
 
       Iterable addedItems = current.getRange(change.index, addEnd);
       previous.replaceRange(change.index, removeEnd, addedItems);
diff --git a/lib/src/observable_map.dart b/lib/src/observable_map.dart
index 7410a31..85f7519 100644
--- a/lib/src/observable_map.dart
+++ b/lib/src/observable_map.dart
@@ -45,7 +45,7 @@
   ObservableMap() : _map = HashMap<K, V>();
 
   /// Creates a new observable map using a [LinkedHashMap].
-  ObservableMap.linked() : _map = LinkedHashMap<K, V>();
+  ObservableMap.linked() : _map = <K, V>{};
 
   /// Creates a new observable map using a [SplayTreeMap].
   ObservableMap.sorted() : _map = SplayTreeMap<K, V>();
@@ -108,8 +108,8 @@
       return;
     }
 
-    int len = _map.length;
-    V oldValue = _map[key];
+    var len = _map.length;
+    var oldValue = _map[key];
 
     _map[key] = value;
 
@@ -131,9 +131,9 @@
   }
 
   @override
-  V putIfAbsent(K key, V ifAbsent()) {
-    int len = _map.length;
-    V result = _map.putIfAbsent(key, ifAbsent);
+  V putIfAbsent(K key, V Function() ifAbsent) {
+    var len = _map.length;
+    var result = _map.putIfAbsent(key, ifAbsent);
     if (hasObservers && len != _map.length) {
       notifyPropertyChange(#length, len, _map.length);
       notifyChange(MapChangeRecord.insert(key, result));
@@ -144,8 +144,8 @@
 
   @override
   V remove(Object key) {
-    int len = _map.length;
-    V result = _map.remove(key);
+    var len = _map.length;
+    var result = _map.remove(key);
     if (hasObservers && len != _map.length) {
       notifyChange(MapChangeRecord.remove(key, result));
       notifyPropertyChange(#length, len, _map.length);
@@ -156,7 +156,7 @@
 
   @override
   void clear() {
-    int len = _map.length;
+    var len = _map.length;
     if (hasObservers && len > 0) {
       _map.forEach((key, value) {
         notifyChange(MapChangeRecord.remove(key, value));
@@ -168,7 +168,7 @@
   }
 
   @override
-  void forEach(void f(K key, V value)) => _map.forEach(f);
+  void forEach(void Function(K key, V value) f) => _map.forEach(f);
 
   @override
   String toString() => MapBase.mapToString(this);
@@ -194,20 +194,21 @@
   }
 
   @override
-  Map<K2, V2> map<K2, V2>(MapEntry<K2, V2> transform(K key, V value)) {
+  Map<K2, V2> map<K2, V2>(MapEntry<K2, V2> Function(K key, V value) transform) {
     return _map.map(transform);
   }
 
   @override
-  V update(K key, V update(V value), {V ifAbsent()}) {
+  V update(K key, V Function(V value) update, {V Function() ifAbsent}) {
     return _map.update(key, update, ifAbsent: ifAbsent);
   }
 
   @override
-  void updateAll(V update(K key, V value)) => _map.updateAll(update);
+  void updateAll(V Function(K key, V value) update) => _map.updateAll(update);
 
   @override
-  void removeWhere(bool test(K key, V value)) => _map.removeWhere(test);
+  void removeWhere(bool Function(K key, V value) test) =>
+      _map.removeWhere(test);
 
   // Note: we don't really have a reasonable old/new value to use here.
   // But this should fix "keys" and "values" in templates with minimal overhead.
diff --git a/lib/src/records/list_change_record.dart b/lib/src/records/list_change_record.dart
index 7f18716..f011ffa 100644
--- a/lib/src/records/list_change_record.dart
+++ b/lib/src/records/list_change_record.dart
@@ -42,8 +42,8 @@
 
   /// Records a `remove` operation at `object[index]` of [removed] elements.
   ListChangeRecord.remove(this.object, this.index, List<E> removed)
-      : this.removed = freezeInDevMode<E>(removed),
-        this.addedCount = 0 {
+      : removed = freezeInDevMode<E>(removed),
+        addedCount = 0 {
     _assertValidState();
   }
 
@@ -52,8 +52,8 @@
   /// If [addedCount] is not specified it defaults to `removed.length`.
   ListChangeRecord.replace(this.object, this.index, List<E> removed,
       [int addedCount])
-      : this.removed = freezeInDevMode<E>(removed),
-        this.addedCount = addedCount ?? removed.length {
+      : removed = freezeInDevMode<E>(removed),
+        addedCount = addedCount ?? removed.length {
     _assertValidState();
   }
 
diff --git a/lib/src/to_observable.dart b/lib/src/to_observable.dart
index 98432c2..01a0345 100644
--- a/lib/src/to_observable.dart
+++ b/lib/src/to_observable.dart
@@ -30,7 +30,7 @@
 /// If a conversion is peformed, mutations are only observed to the result of
 /// this function. Changing the original collection will not affect it.
 // TODO(jmesserly): ObservableSet?
-toObservable(dynamic value, {bool deep = true}) =>
+dynamic toObservable(dynamic value, {bool deep = true}) =>
     deep ? _toObservableDeep(value) : _toObservableShallow(value);
 
 /// Converts the [Iterable] to an [ObservableList].
diff --git a/test/change_notifier_test.dart b/test/change_notifier_test.dart
index c2a3698..3fb9bba 100644
--- a/test/change_notifier_test.dart
+++ b/test/change_notifier_test.dart
@@ -31,8 +31,8 @@
 
   group(ChangeNotifier, () {
     Future<void> runTest<T extends ChangeRecord>(
-        FutureOr<void> runFn(ChangeNotifier<T> cn),
-        FutureOr<void> testFn(ChangeRecords<T> cr)) async {
+        FutureOr<void> Function(ChangeNotifier<T> cn) runFn,
+        FutureOr<void> Function(ChangeRecords<T> cr) testFn) async {
       final cn = ChangeNotifier<T>();
 
       cn.changes.listen((value) {
@@ -83,7 +83,7 @@
       super == other &&
           other is B &&
           runtimeType == other.runtimeType &&
-          this.value == other.value;
+          value == other.value;
 
   @override
   int get hashCode => value.hashCode;
diff --git a/test/list_change_test.dart b/test/list_change_test.dart
index fe53ccc..7af27af 100644
--- a/test/list_change_test.dart
+++ b/test/list_change_test.dart
@@ -12,7 +12,7 @@
 // This file contains code ported from:
 // https://github.com/rafaelw/ChangeSummary/blob/master/tests/test.js
 
-main() => listChangeTests();
+void main() => listChangeTests();
 
 // TODO(jmesserly): port or write array fuzzer tests
 void listChangeTests() {
@@ -69,7 +69,7 @@
   });
 
   group('List deltas can be applied', () {
-    applyAndCheckDeltas(model, copy, changes) => changes.then((summary) {
+    void applyAndCheckDeltas(model, copy, changes) => changes.then((summary) {
           // apply deltas to the copy
           for (ListChangeRecord delta in summary) {
             delta.apply(copy);
@@ -229,7 +229,8 @@
   });
 
   group('edit distance', () {
-    assertEditDistance(orig, changes, expectedDist) => changes.then((summary) {
+    void assertEditDistance(orig, changes, expectedDist) =>
+        changes.then((summary) {
           var actualDistance = 0;
           for (var delta in summary) {
             actualDistance += delta.addedCount + delta.removed.length;
diff --git a/test/map_differ_test.dart b/test/map_differ_test.dart
index 40268e4..6abb2a4 100644
--- a/test/map_differ_test.dart
+++ b/test/map_differ_test.dart
@@ -1,7 +1,7 @@
 import 'package:observable/observable.dart';
 import 'package:test/test.dart';
 
-main() {
+void main() {
   group('$MapDiffer', () {
     final diff = const MapDiffer<String, String>().diff;
 
diff --git a/test/observable_list_test.dart b/test/observable_list_test.dart
index 73573c4..4d87efc 100644
--- a/test/observable_list_test.dart
+++ b/test/observable_list_test.dart
@@ -9,14 +9,12 @@
 
 import 'observable_test_utils.dart';
 
-main() => _runTests();
-
-_runTests() {
+void main() {
   // TODO(jmesserly): need all standard List API tests.
 
   StreamSubscription sub, sub2;
 
-  sharedTearDown() {
+  void sharedTearDown() {
     list = null;
     sub.cancel();
     if (sub2 != null) {
@@ -217,7 +215,7 @@
       expect(list.indexOf(1, 1), 3);
       expect(list.lastIndexOf(1), 3);
       expect(list.last, 4);
-      var copy = List<int>();
+      var copy = <int>[];
       list.forEach((int i) => copy.add(i));
       expect(copy, orderedEquals([1, 2, 3, 1, 3, 4]));
       return Future(() {
@@ -344,5 +342,5 @@
 PropertyChangeRecord<int> _lengthChange(int oldValue, int newValue) =>
     PropertyChangeRecord<int>(list, #length, oldValue, newValue);
 
-_change(int index, {List removed = const [], int addedCount = 0}) =>
+void _change(int index, {List removed = const [], int addedCount = 0}) =>
     ListChangeRecord(list, index, removed: removed, addedCount: addedCount);
diff --git a/test/observable_map_test.dart b/test/observable_map_test.dart
index 569132e..86ad424 100644
--- a/test/observable_map_test.dart
+++ b/test/observable_map_test.dart
@@ -9,14 +9,12 @@
 
 import 'observable_test_utils.dart';
 
-main() => _runTests();
-
-_runTests() {
+void main() {
   // TODO(jmesserly): need all standard Map API tests.
 
   StreamSubscription sub;
 
-  sharedTearDown() {
+  void sharedTearDown() {
     if (sub != null) {
       sub.cancel();
       sub = null;
@@ -395,9 +393,9 @@
 MapChangeRecord _changeKey(key, old, newValue) =>
     MapChangeRecord(key, old, newValue);
 
-_insertKey(key, newValue) => MapChangeRecord.insert(key, newValue);
+ChangeRecord _insertKey(key, newValue) => MapChangeRecord.insert(key, newValue);
 
-_removeKey(key, oldValue) => MapChangeRecord.remove(key, oldValue);
+ChangeRecord _removeKey(key, oldValue) => MapChangeRecord.remove(key, oldValue);
 
 PropertyChangeRecord<Null> _propChange(map, prop) =>
     PropertyChangeRecord<Null>(map, prop, null, null);
diff --git a/test/observable_test.dart b/test/observable_test.dart
index e74660c..de4562a 100644
--- a/test/observable_test.dart
+++ b/test/observable_test.dart
@@ -48,7 +48,7 @@
 
   test('changes delived async', () {
     var t = createModel(123);
-    int called = 0;
+    var called = 0;
 
     subs.add(t.changes.listen(expectAsync1((records) {
       called++;
@@ -62,7 +62,7 @@
 
   test('cause changes in handler', () {
     var t = createModel(123);
-    int called = 0;
+    var called = 0;
 
     subs.add(t.changes.listen(expectAsync1((records) {
       called++;
@@ -79,7 +79,7 @@
   test('multiple observers', () {
     var t = createModel(123);
 
-    verifyRecords(records) {
+    void verifyRecords(records) {
       expectPropertyChanges(records, 2);
     }
 
@@ -196,7 +196,7 @@
   });
 }
 
-expectPropertyChanges(records, int number) {
+void expectPropertyChanges(records, int number) {
   expect(records.length, number, reason: 'expected $number change records');
   for (var record in records) {
     expect(record is PropertyChangeRecord, true,
@@ -206,14 +206,14 @@
   }
 }
 
-createModel(int number) => ObservableSubclass(number);
+ObservableSubclass createModel(int number) => ObservableSubclass(number);
 
 class ObservableSubclass<T> extends PropertyChangeNotifier {
   ObservableSubclass([T initialValue]) : _value = initialValue;
 
   T get value => _value;
   set value(T newValue) {
-    T oldValue = _value;
+    var oldValue = _value;
     _value = newValue;
     notifyPropertyChange(#value, oldValue, newValue);
   }
diff --git a/test/observable_test_utils.dart b/test/observable_test_utils.dart
index b705e7c..14a8b37 100644
--- a/test/observable_test_utils.dart
+++ b/test/observable_test_utils.dart
@@ -13,7 +13,7 @@
 /// to happen in the next microtask:
 ///
 ///     future.then(newMicrotask).then(...)
-newMicrotask(_) => Future.value();
+Future newMicrotask(_) => Future.value();
 
 void expectChanges(List<ChangeRecord> actual, List<ChangeRecord> expected,
     {String reason}) {