diff --git a/DEPS b/DEPS index 8ca02429d73..36d9a9270e8 100644 --- a/DEPS +++ b/DEPS @@ -123,7 +123,7 @@ vars = { "oauth2_tag": "1.6.0", "package_config_rev": "9c586d04bd26fef01215fd10e7ab96a3050cfa64", "path_rev": "4f3bb71843fe5493ba490828a1721821d7b33746", - "pedantic_tag": "v1.9.0", + "pedantic_tag": "v1.9.1", "ply_rev": "604b32590ffad5cbb82e4afef1d305512d06ae93", "pool_rev": "86fbb2cde9bbc66c8d159909d2f65a5981ea5b50", "protobuf_rev": "3746c8fd3f2b0147623a8e3db89c3ff4330de760", diff --git a/pkg/meta/CHANGELOG.md b/pkg/meta/CHANGELOG.md index 3c6b8de421c..9f3f80affef 100644 --- a/pkg/meta/CHANGELOG.md +++ b/pkg/meta/CHANGELOG.md @@ -1,9 +1,20 @@ -## 1.2.0-nnbd +## 1.3.0-nnbd * Opt into null safety. + +## 1.2.1 + +* Fixed a bug by adding an import of dart:async so that the code really is + compatible with the lower bound of the SDK constraints. + +## 1.2.0 + * Introduce `@doNotStore` to annotate methods, getters and functions to indicate that values obtained by invoking them should not be stored in a field or top-level variable. +* Introduce `unawaited` to mark invocations that return a `Future` where it's + intentional that the future is not being awaited. (Moved from + `package:pedantic`.) ## 1.1.8 diff --git a/pkg/meta/lib/meta.dart b/pkg/meta/lib/meta.dart index 7f933686f0b..067cdf8618f 100644 --- a/pkg/meta/lib/meta.dart +++ b/pkg/meta/lib/meta.dart @@ -1,8 +1,9 @@ -// Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file +// Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file // 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. -/// Constants for use in metadata annotations. +/// Constants and functions that developers can use to express the intentions +/// that otherwise can't be deduced by statically analyzing the source code. /// /// See also `@deprecated` and `@override` in the `dart:core` library. /// @@ -12,7 +13,7 @@ /// function's name differently. /// /// For information on installing and importing this library, see the [meta -/// package on pub.dev](https://pub.dev/packages/meta). For examples of using +/// package on pub.dev](https://pub.dev/packages/meta). For examples of using /// annotations, see /// [Metadata](https://dart.dev/guides/language/language-tour#metadata) in the /// language tour. @@ -266,6 +267,26 @@ const _VisibleForOverriding visibleForOverriding = _VisibleForOverriding(); /// library which is in the `test` folder of the defining package. const _VisibleForTesting visibleForTesting = _VisibleForTesting(); +/// 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) {} + /// Used to annotate a class. /// /// See [immutable] for more details. diff --git a/pkg/meta/pubspec.yaml b/pkg/meta/pubspec.yaml index 0a745e0ded7..051c3aaaa03 100644 --- a/pkg/meta/pubspec.yaml +++ b/pkg/meta/pubspec.yaml @@ -1,11 +1,11 @@ name: meta -version: 1.2.0-nnbd -author: Dart Team +version: 1.3.0-nnbd homepage: https://github.com/dart-lang/sdk/tree/master/pkg/meta description: > - This library contains the definitions of annotations that provide additional - semantic information about the program being annotated. These annotations are - intended to be used by tools to provide a better user experience. + This library contains the declarations of constants and functions that + developers can use to express the intentions that otherwise can't be deduced by + statically analyzing the source code. These declarations are intended to be + used by tools to provide a better user experience. environment: # This must remain a tight constraint (only allow dev versions) until nnbd is # stable.