Fix lints/pedantic, require Dart 2.14 (dart-lang/watcher#122)
diff --git a/pkgs/watcher/.github/workflows/test-package.yml b/pkgs/watcher/.github/workflows/test-package.yml index 36c2478..971c6f0 100644 --- a/pkgs/watcher/.github/workflows/test-package.yml +++ b/pkgs/watcher/.github/workflows/test-package.yml
@@ -46,7 +46,7 @@ fail-fast: false matrix: os: [ubuntu-latest, macos-latest, windows-latest] - sdk: [2.12.0, dev] + sdk: [2.14.0, dev] steps: - uses: actions/checkout@v2 - uses: dart-lang/setup-dart@v1.0
diff --git a/pkgs/watcher/CHANGELOG.md b/pkgs/watcher/CHANGELOG.md index fd5efe3..d987225 100644 --- a/pkgs/watcher/CHANGELOG.md +++ b/pkgs/watcher/CHANGELOG.md
@@ -1,3 +1,7 @@ +# 1.0.2-dev + +- Require Dart SDK >= 2.14 + # 1.0.1 * Drop package:pedantic and use package:lints instead.
diff --git a/pkgs/watcher/lib/src/async_queue.dart b/pkgs/watcher/lib/src/async_queue.dart index eca28ad..f6c76a9 100644 --- a/pkgs/watcher/lib/src/async_queue.dart +++ b/pkgs/watcher/lib/src/async_queue.dart
@@ -66,6 +66,5 @@ // We have drained the queue, stop processing and wait until something // has been enqueued. _isProcessing = false; - return null; } }
diff --git a/pkgs/watcher/lib/src/directory_watcher/mac_os.dart b/pkgs/watcher/lib/src/directory_watcher/mac_os.dart index 4ad94d4..2046ce0 100644 --- a/pkgs/watcher/lib/src/directory_watcher/mac_os.dart +++ b/pkgs/watcher/lib/src/directory_watcher/mac_os.dart
@@ -7,8 +7,8 @@ import 'package:path/path.dart' as p; -import '../directory_watcher.dart'; import '../constructable_file_system_event.dart'; +import '../directory_watcher.dart'; import '../path_set.dart'; import '../resubscribable.dart'; import '../utils.dart'; @@ -78,9 +78,7 @@ /// events (see issue 14373). late Timer _bogusEventTimer; - _MacOSDirectoryWatcher(String path) - : path = path, - _files = PathSet(path) { + _MacOSDirectoryWatcher(this.path) : _files = PathSet(path) { _startWatch(); // Before we're ready to emit events, wait for [_listDir] to complete and
diff --git a/pkgs/watcher/lib/src/directory_watcher/windows.dart b/pkgs/watcher/lib/src/directory_watcher/windows.dart index a8200ee..09b4b36 100644 --- a/pkgs/watcher/lib/src/directory_watcher/windows.dart +++ b/pkgs/watcher/lib/src/directory_watcher/windows.dart
@@ -26,14 +26,14 @@ } class _EventBatcher { - static const Duration _BATCH_DELAY = Duration(milliseconds: 100); + static const Duration _batchDelay = Duration(milliseconds: 100); final List<FileSystemEvent> events = []; Timer? timer; void addEvent(FileSystemEvent event, void Function() callback) { events.add(event); timer?.cancel(); - timer = Timer(_BATCH_DELAY, callback); + timer = Timer(_batchDelay, callback); } void cancelTimer() { @@ -87,9 +87,7 @@ final Set<StreamSubscription<FileSystemEntity>> _listSubscriptions = HashSet<StreamSubscription<FileSystemEntity>>(); - _WindowsDirectoryWatcher(String path) - : path = path, - _files = PathSet(path) { + _WindowsDirectoryWatcher(this.path) : _files = PathSet(path) { // Before we're ready to emit events, wait for [_listDir] to complete. _listDir().then((_) { _startWatch();
diff --git a/pkgs/watcher/lib/src/file_watcher/polling.dart b/pkgs/watcher/lib/src/file_watcher/polling.dart index 9b9ac5b..d0b219f 100644 --- a/pkgs/watcher/lib/src/file_watcher/polling.dart +++ b/pkgs/watcher/lib/src/file_watcher/polling.dart
@@ -5,8 +5,6 @@ import 'dart:async'; import 'dart:io'; -import 'package:pedantic/pedantic.dart'; - import '../file_watcher.dart'; import '../resubscribable.dart'; import '../stat.dart';
diff --git a/pkgs/watcher/lib/src/watch_event.dart b/pkgs/watcher/lib/src/watch_event.dart index 8b3fabb..b65afc2 100644 --- a/pkgs/watcher/lib/src/watch_event.dart +++ b/pkgs/watcher/lib/src/watch_event.dart
@@ -19,12 +19,15 @@ /// Enum for what kind of change has happened to a file. class ChangeType { /// A new file has been added. + // ignore: constant_identifier_names static const ADD = ChangeType('add'); /// A file has been removed. + // ignore: constant_identifier_names static const REMOVE = ChangeType('remove'); /// The contents of a file have changed. + // ignore: constant_identifier_names static const MODIFY = ChangeType('modify'); final String _name;
diff --git a/pkgs/watcher/pubspec.yaml b/pkgs/watcher/pubspec.yaml index 19e572c..b4102c5 100644 --- a/pkgs/watcher/pubspec.yaml +++ b/pkgs/watcher/pubspec.yaml
@@ -1,5 +1,5 @@ name: watcher -version: 1.0.1 +version: 1.0.2-dev description: >- A file system watcher. It monitors changes to contents of directories and @@ -17,5 +17,5 @@ lints: ^1.0.0 benchmark_harness: ^2.0.0 test: ^1.16.0 - test_descriptor: ^2.0.0-nullsafety + test_descriptor: ^2.0.0
diff --git a/pkgs/watcher/test/no_subscription/shared.dart b/pkgs/watcher/test/no_subscription/shared.dart index bcdba5f..e7a6144 100644 --- a/pkgs/watcher/test/no_subscription/shared.dart +++ b/pkgs/watcher/test/no_subscription/shared.dart
@@ -2,8 +2,9 @@ // for details. All rights reserved. Use of this source code is governed by a // BSD-style license that can be found in the LICENSE file. +import 'dart:async'; + import 'package:async/async.dart'; -import 'package:pedantic/pedantic.dart'; import 'package:test/test.dart'; import 'package:watcher/watcher.dart';
diff --git a/pkgs/watcher/test/ready/shared.dart b/pkgs/watcher/test/ready/shared.dart index ebe2f0c..b6b3cce 100644 --- a/pkgs/watcher/test/ready/shared.dart +++ b/pkgs/watcher/test/ready/shared.dart
@@ -2,7 +2,8 @@ // for details. All rights reserved. Use of this source code is governed by a // BSD-style license that can be found in the LICENSE file. -import 'package:pedantic/pedantic.dart'; +import 'dart:async'; + import 'package:test/test.dart'; import '../utils.dart';
diff --git a/pkgs/watcher/test/utils.dart b/pkgs/watcher/test/utils.dart index aa23d50..8d8981c 100644 --- a/pkgs/watcher/test/utils.dart +++ b/pkgs/watcher/test/utils.dart
@@ -2,11 +2,11 @@ // for details. All rights reserved. Use of this source code is governed by a // BSD-style license that can be found in the LICENSE file. +import 'dart:async'; import 'dart:io'; import 'package:async/async.dart'; import 'package:path/path.dart' as p; -import 'package:pedantic/pedantic.dart'; import 'package:test/test.dart'; import 'package:test_descriptor/test_descriptor.dart' as d; import 'package:watcher/src/stat.dart';