From 3516982490b73ca1cd391374e940e82ac59b7700 Mon Sep 17 00:00:00 2001 From: David Morgan Date: Thu, 9 Jul 2020 15:24:03 +0200 Subject: [PATCH 1/2] Revert dep on meta. --- CHANGELOG.md | 4 ++++ lib/pedantic.dart | 22 +++++++++++++++++++++- pubspec.yaml | 5 +---- 3 files changed, 26 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0712361d59e4d..98418ae37b0a8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +## 1.9.2 + +Revert changes in `1.9.1` due to problems moving `unawaited` to `meta`. + ## 1.9.1 `package:meta` is now the recommended place to get the `unawaited` method. diff --git a/lib/pedantic.dart b/lib/pedantic.dart index 49af63a25953c..f6489f51b3d6e 100644 --- a/lib/pedantic.dart +++ b/lib/pedantic.dart @@ -2,4 +2,24 @@ // 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. -export 'package:meta/meta.dart' show unawaited; +import 'dart:async' show Future; + +/// Indicates to tools that [future] is intentionally not `await`-ed. +/// +/// In an `async` context, it is normally expected that all [Future]s are +/// awaited, and that is the basis of the lint `unawaited_futures`. However, +/// there are times where one or more futures are intentionally not awaited. +/// This function may be used to ignore a particular future. It silences the +/// `unawaited_futures` lint. +/// +/// ``` +/// Future saveUserPreferences() async { +/// await _writePreferences(); +/// +/// // While 'log' returns a Future, the consumer of 'saveUserPreferences' +/// // is unlikely to want to wait for that future to complete; they only +/// // care about the preferences being written). +/// unawaited(log('Preferences saved!')); +/// } +/// ``` +void unawaited(Future future) {} diff --git a/pubspec.yaml b/pubspec.yaml index 5957c9fdb7ce4..ab5f4b4521f4f 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,11 +1,8 @@ name: pedantic -version: 1.9.1 +version: 1.9.2 description: >- The Dart analyzer settings and best practices used internally at Google. homepage: https://github.com/dart-lang/pedantic environment: sdk: '>=2.1.1 <3.0.0' - -dependencies: - meta: ^1.2.0 From dbef004f023659b7aeca9439642be37913c8a084 Mon Sep 17 00:00:00 2001 From: David Morgan Date: Thu, 9 Jul 2020 17:08:32 +0200 Subject: [PATCH 2/2] Update pubspec.yaml Co-authored-by: Jacob MacDonald --- pubspec.yaml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/pubspec.yaml b/pubspec.yaml index ab5f4b4521f4f..c6efeb25d7e6a 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -6,3 +6,6 @@ homepage: https://github.com/dart-lang/pedantic environment: sdk: '>=2.1.1 <3.0.0' + +dependencies: + meta: ^1.2.2