Merge branch 'master' into race-condition
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 251c13e..b17222c 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,3 +1,8 @@
+# 0.9.8
+
+* Fix a race condition issue with the `PollingDirectoryWatcher`.
+* Internal clean up, e.g. fix and enable lints.
+
 # 0.9.7+12
 
 * Catch `FileSystemException` during `existsSync()` on Windows.
@@ -20,7 +25,7 @@
 
 # 0.9.7+7
 
-* Updates to support Dart 2.0 core library changes (wave 2.2). 
+* Updates to support Dart 2.0 core library changes (wave 2.2).
   See [issue 31847][sdk#31847] for details.
 
   [sdk#31847]: https://github.com/dart-lang/sdk/issues/31847
@@ -28,7 +33,7 @@
 
 # 0.9.7+6
 
-* Internal changes only, namely removing dep on scheduled test. 
+* Internal changes only, namely removing dep on scheduled test.
 
 # 0.9.7+5
 
diff --git a/lib/src/directory_watcher/polling.dart b/lib/src/directory_watcher/polling.dart
index f21a239..f95deff 100644
--- a/lib/src/directory_watcher/polling.dart
+++ b/lib/src/directory_watcher/polling.dart
@@ -136,29 +136,34 @@
       return;
     }
 
-    final modified = await modificationTime(file);
+    try {
+      final modified = await modificationTime(file);
 
-    if (_events.isClosed) return;
+      if (_events.isClosed) return;
 
-    var lastModified = _lastModifieds[file];
+      var lastModified = _lastModifieds[file];
 
-    // If its modification time hasn't changed, assume the file is unchanged.
-    if (lastModified != null && lastModified == modified) {
-      // The file is still here.
+      // If its modification time hasn't changed, assume the file is unchanged.
+      if (lastModified != null && lastModified == modified) {
+        // The file is still here.
+        _polledFiles.add(file);
+        return;
+      }
+
+      if (_events.isClosed) return;
+
+      _lastModifieds[file] = modified;
       _polledFiles.add(file);
-      return;
+
+      // Only notify if we're ready to emit events.
+      if (!isReady) return;
+
+      var type = lastModified == null ? ChangeType.ADD : ChangeType.MODIFY;
+      _events.add(WatchEvent(type, file));
+    } on FileSystemException {
+      // Ignore as the file could have been removed since the poll.
+      // The `_completePoll` step will handle this situation.
     }
-
-    if (_events.isClosed) return;
-
-    _lastModifieds[file] = modified;
-    _polledFiles.add(file);
-
-    // Only notify if we're ready to emit events.
-    if (!isReady) return;
-
-    var type = lastModified == null ? ChangeType.ADD : ChangeType.MODIFY;
-    _events.add(WatchEvent(type, file));
   }
 
   /// After the directory listing is complete, this determines which files were
diff --git a/pubspec.yaml b/pubspec.yaml
index 3722c84..5fb8231 100644
--- a/pubspec.yaml
+++ b/pubspec.yaml
@@ -1,5 +1,5 @@
 name: watcher
-version: 0.9.8-dev
+version: 0.9.8
 
 description: >-
   A file system watcher. It monitors changes to contents of directories and