From 59f7bfacee8e45459830a0dd8be416cc9477ef16 Mon Sep 17 00:00:00 2001 From: Oleh Prypin Date: Thu, 25 Jan 2024 21:21:45 +0100 Subject: [PATCH] Deprecate whereNotNull from IterableNullableExtensions Dart SDK since 3.0 has an exact equivalent extension `nonNulls` in the core. --- CHANGELOG.md | 3 +++ lib/src/iterable_extensions.dart | 1 + 2 files changed, 4 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index e38e1a8..7bed0e7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,9 @@ - Shuffle `IterableExtension.sample` results. - Fix `mergeSort` when the runtime iterable generic is a subtype of the static generic. +- Deprecate `whereNotNull()` from `IterableNullableExtension`. Use `nonNulls` + instead - this is an equivalent extension available in Dart core since + version 3.0. - Require Dart `^3.1.0` - Mark "mixin" classes as `mixin`. diff --git a/lib/src/iterable_extensions.dart b/lib/src/iterable_extensions.dart index 1bf4b3e..0d52fbb 100644 --- a/lib/src/iterable_extensions.dart +++ b/lib/src/iterable_extensions.dart @@ -611,6 +611,7 @@ extension IterableNullableExtension on Iterable { /// of this iterable, in their original iteration order. /// /// For an `Iterable`, this method is equivalent to `.whereType()`. + @Deprecated('Use .nonNulls instead.') Iterable whereNotNull() sync* { for (var element in this) { if (element != null) yield element;