From 5e237b1792db7525cf024c815d8f666b1d6a64d2 Mon Sep 17 00:00:00 2001 From: evanweible-wf Date: Fri, 9 Jun 2023 11:32:14 -0600 Subject: [PATCH 1/2] Fix type mismatch between `DevTool.fromFunction()` and `DevTool.run()` --- CHANGELOG.md | 6 ++++++ lib/src/dart_dev_tool.dart | 2 +- lib/src/tools/function_tool.dart | 4 ++-- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3b15bc46..dc3d9e2a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,11 @@ # Changelog +## 4.0.1 + +- Fix type mismatch between the expected return type of the function passed to +`DevTool.fromFunction()` and the `DevTool.run()` method. The updated type is +more permissive and so should not be breaking. + ## 4.0.0 - Migrated to null safety. The new SDK minimum is 2.18 diff --git a/lib/src/dart_dev_tool.dart b/lib/src/dart_dev_tool.dart index 4bcc9ff5..b2bf5174 100644 --- a/lib/src/dart_dev_tool.dart +++ b/lib/src/dart_dev_tool.dart @@ -12,7 +12,7 @@ abstract class DevTool { DevTool(); factory DevTool.fromFunction( - FutureOr? Function(DevToolExecutionContext context) function, + FutureOr Function(DevToolExecutionContext context) function, {ArgParser? argParser}) => FunctionTool(function, argParser: argParser); diff --git a/lib/src/tools/function_tool.dart b/lib/src/tools/function_tool.dart index a9f2ea01..a777346a 100644 --- a/lib/src/tools/function_tool.dart +++ b/lib/src/tools/function_tool.dart @@ -13,12 +13,12 @@ import '../utils/assert_no_positional_args_nor_args_after_separator.dart'; /// Use [DevTool.fromFunction] to create [FunctionTool] instances. class FunctionTool extends DevTool { FunctionTool( - FutureOr? Function(DevToolExecutionContext context) function, + FutureOr Function(DevToolExecutionContext context) function, {ArgParser? argParser}) : _argParser = argParser, _function = function; - final FutureOr? Function(DevToolExecutionContext context) _function; + final FutureOr Function(DevToolExecutionContext context) _function; // --------------------------------------------------------------------------- // DevTool Overrides From a7c664e86318072d98a479a645edd0ee3fd55926 Mon Sep 17 00:00:00 2001 From: evanweible-wf Date: Fri, 9 Jun 2023 11:59:38 -0600 Subject: [PATCH 2/2] Disable CI on stable for now --- .github/workflows/dart_ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/dart_ci.yml b/.github/workflows/dart_ci.yml index 3de30e68..5ae18324 100644 --- a/.github/workflows/dart_ci.yml +++ b/.github/workflows/dart_ci.yml @@ -15,7 +15,7 @@ jobs: strategy: fail-fast: false matrix: - sdk: [ 2.18.7, stable ] + sdk: [ 2.18.7 ] # TODO: re-add stable when compatible steps: - uses: actions/checkout@v3 - uses: dart-lang/setup-dart@v1 @@ -44,7 +44,7 @@ jobs: - uses: actions/checkout@v3 - uses: dart-lang/setup-dart@v1 with: - sdk: stable + sdk: 2.18.7 - id: install name: Install dependencies