Fix PollingFileWatcher.ready for files that don't exist (#157)

There were a few issues here:

- FileWatcher.ready never fired for files that don't exist because of logic inside FileWatcher existing early if the modification time was `null`
- The test I recently added trying to catch this was incorrectly passing because the mock timestamp code was set so that files that had not been created would return a 0-mtime whereas in the real implementation they return `null`

So this change

a) updates the mock to return `null` for uncreated files (to match the real implementation) which breaks a bunch of tests

b) fixes those tests by updating FileWatcher._poll() to handle `null` mtime separately from being the first poll.
4 files changed
tree: 15f1a8d83cf28b6b7bdd7d5cf08897f3e845de17
  1. .github/
  2. benchmark/
  3. example/
  4. lib/
  5. test/
  6. .gitignore
  7. .test_config
  8. analysis_options.yaml
  11. pubspec.yaml

Dart CI pub package package publisher

A file system watcher.

What's this?

package:watcher monitors changes to contents of directories and sends notifications when files have been added, removed, or modified.