async_extension
Dart async extensions, to help usage of Future, FutureOr and async methods. Also allows performance improvements when using sync and async code.
1.2.22
38K downloads/mo
#1681 most downloaded on pub.dev
eneural-net/async_extension
What this package is like to depend on
Last release 5 months ago
25 Mar 2026
Release timing varies
gaps range from 1 weeks to 9 months
Nearly every release is documented
notes for 38 of 38 stable releases
Nothing withdrawn
no release was ever pulled
5 years old
38 releases · first in 2021
7 releases in the last 12 months
see the full history below
Release timeline
38 releases · Jun 2021 to Mar 2026Releases
latest 38-
1.2.2225 Mar 2026Release notes
Open source →ObjectExtension<T>:- Added method
whenthat returnsthisif a condition evaluates totrue, otherwisenull.
- Added method
FutureOrExtension<T>:- Added method
whenAsyncas an async-aware version ofwhen, returningthisornullbased on a condition evaluation.
- Added method
Release notes
Open source →ObjectExtension<T>:- Added method
whenthat returnsthisif a condition evaluates totrue, otherwisenull.
- Added method
FutureOrExtension<T>:- Added method
whenAsyncas an async-aware version ofwhen, returningthisornullbased on a condition evaluation.
- Added method
-
1.2.2111 Feb 2026Release notes
Open source →-
ComputeOnceCache:- Added
callsLengthgetter to return the number of cached computations.
- Added
-
ComputeOnceCachedIDs:- Made
comparefield non-nullable and always initialized with a comparator (defaulting to_Comparer._defaultCompare). - Updated internal logic to consistently use non-null
compare. - Improved sorting and deduplication logic in
ComputeIDsconstructor. - Enhanced
computeIDsandgetByIDsmethods to correctly merge and order results by IDs. - Added detailed handling to preserve order and sorting of IDs and results.
- Made
-
ComputeIDs:- Made
comparefield non-nullable and always initialized. - Added
checkIDsSortedmethod to verify internal ID ordering. - Simplified and unified binary search and intersection logic to rely on non-null comparator.
- Improved
intersectionmethod to preserve input order of IDs. - Improved
getValuesByIndexesto handle cases where values list length differs from IDs length and ensure sorted output. - Simplified
equalsIDsto always use comparator.
- Made
-
ListIdValuePairExtension:- Updated
binarySearchIndexandbinarySearchmethods to require non-null comparator argument.
- Updated
-
_Comparer:- Updated
binarySearchIndexto require non-null comparator argument.
- Updated
Release notes
Open source →-
ComputeOnceCache:- Added
callsLengthgetter to return the number of cached computations.
- Added
-
ComputeOnceCachedIDs:- Made
comparefield non-nullable and always initialized with a comparator (defaulting to_Comparer._defaultCompare). - Updated internal logic to consistently use non-null
compare. - Improved sorting and deduplication logic in
ComputeIDsconstructor. - Enhanced
computeIDsandgetByIDsmethods to correctly merge and order results by IDs. - Added detailed handling to preserve order and sorting of IDs and results.
- Made
-
ComputeIDs:- Made
comparefield non-nullable and always initialized. - Added
checkIDsSortedmethod to verify internal ID ordering. - Simplified and unified binary search and intersection logic to rely on non-null comparator.
- Improved
intersectionmethod to preserve input order of IDs. - Improved
getValuesByIndexesto handle cases where values list length differs from IDs length and ensure sorted output. - Simplified
equalsIDsto always use comparator.
- Made
-
ListIdValuePairExtension:- Updated
binarySearchIndexandbinarySearchmethods to require non-null comparator argument.
- Updated
-
_Comparer:- Updated
binarySearchIndexto require non-null comparator argument.
- Updated
-
-
1.2.2023 Jan 2026Release notes
Open source →-
ComputeOnce:- Renamed
ComputeOnceCalltoComputeCall. - Added
PosComputeCallcallback invoked after computation completes, receiving success or error results. - Added
posComputefield to invoke post-computation callback. - Updated
resolveandresolveAsyncto applyposComputeon success or error.
- Renamed
-
TimedComputeOnce:- Added support for
posComputecallback.
- Added support for
-
Added
ComputeOnceCache:- Caches
TimedComputeOnceinstances by key. - Supports retention duration for cached entries with automatic eviction.
- Provides
getmethod to retrieve or create cached computations.
- Caches
-
Added
ComputeOnceCachedIDs:- Extends
ComputeOnceCachefor batched computations by ID sets. - Supports ID ordering, hashing, and deduplication.
- Shares in-flight computations for overlapping ID sets.
- Provides
getByIDsto get computations for subsets of IDs. - Provides
computeIDsto compute and merge results for requested IDs, preserving order.
- Extends
-
Added
ComputeIDs:- Represents an ordered, comparable, and hashable set of IDs.
- Supports binary search, intersection, equality, and hashing.
-
Added extensions:
IterableComputeOnceExtensionfor resolving multipleComputeOnceinstances.MapComputeIDsExtensionfor resolving maps ofTimedComputeOncekeyed byComputeIDs.ListIdValuePairExtensionfor binary searching(ID, value)pairs sorted by ID.
-
Typedefs:
ComputeCallIDsfor batched ID computations.ComputeIDCompareandComputeIDHashfor ID comparison and hashing.
Release notes
Open source →-
ComputeOnce:- Renamed
ComputeOnceCalltoComputeCall. - Added
PosComputeCallcallback invoked after computation completes, receiving success or error results. - Added
posComputefield to invoke post-computation callback. - Updated
resolveandresolveAsyncto applyposComputeon success or error.
- Renamed
-
TimedComputeOnce:- Added support for
posComputecallback.
- Added support for
-
Added
ComputeOnceCache:- Caches
TimedComputeOnceinstances by key. - Supports retention duration for cached entries with automatic eviction.
- Provides
getmethod to retrieve or create cached computations.
- Caches
-
Added
ComputeOnceCachedIDs:- Extends
ComputeOnceCachefor batched computations by ID sets. - Supports ID ordering, hashing, and deduplication.
- Shares in-flight computations for overlapping ID sets.
- Provides
getByIDsto get computations for subsets of IDs. - Provides
computeIDsto compute and merge results for requested IDs, preserving order.
- Extends
-
Added
ComputeIDs:- Represents an ordered, comparable, and hashable set of IDs.
- Supports binary search, intersection, equality, and hashing.
-
Added extensions:
IterableComputeOnceExtensionfor resolving multipleComputeOnceinstances.MapComputeIDsExtensionfor resolving maps ofTimedComputeOncekeyed byComputeIDs.ListIdValuePairExtensionfor binary searching(ID, value)pairs sorted by ID.
-
Typedefs:
ComputeCallIDsfor batched ID computations.ComputeIDCompareandComputeIDHashfor ID comparison and hashing.
-
-
1.2.1921 Jan 2026Release notes
Open source →-
FunctionArgs0Extension,FunctionArgs1Extension,FunctionArgs2Extension:tryCall: updated to catch errors from synchronous or asynchronous results and applyonErrorviaFuture.catchErrorif the result is aFuture.
-
ComputeOnce<V>:- Constructor:
- Added static helper
_resolveCallto widen callbacks returningFuture<Never>toFutureOr<V>. - Wrap
_callwith_resolveCallto fixFuture<Never>callbacks.
- Added static helper
- Added
isResolvinggetter to indicate if computation is in progress. - Enhanced
resolvemethod:- Added parameters
throwError,onError, andonErrorValueto control error handling behavior. - Supports returning fallback values or invoking error handlers instead of always throwing.
- Calls
onComputecallback on completion with value or error.
- Added parameters
- Enhanced
resolveAsyncmethod:- Added parameters
throwError,onError, andonErrorValuefor asynchronous error handling. - Calls
onComputecallback on completion.
- Added parameters
- Added
onComputecallback method invoked once computation completes. - Added
classNamegetter and improvedtoStringto reflect current state (resolving, resolved with value, or error).
- Constructor:
-
Added
TimedComputeOnce<V>subclass:- Records the timestamp when computation resolves (success or failure).
- Provides
resolvedAttimestamp andelapsedTimesince resolution. - Overrides
onComputeto set resolution time. - Overrides
classNamefor identification.
Release notes
Open source →-
FunctionArgs0Extension,FunctionArgs1Extension,FunctionArgs2Extension:tryCall: updated to catch errors from synchronous or asynchronous results and applyonErrorviaFuture.catchErrorif the result is aFuture.
-
ComputeOnce<V>:- Constructor:
- Added static helper
_resolveCallto widen callbacks returningFuture<Never>toFutureOr<V>. - Wrap
_callwith_resolveCallto fixFuture<Never>callbacks.
- Added static helper
- Added
isResolvinggetter to indicate if computation is in progress. - Enhanced
resolvemethod:- Added parameters
throwError,onError, andonErrorValueto control error handling behavior. - Supports returning fallback values or invoking error handlers instead of always throwing.
- Calls
onComputecallback on completion with value or error.
- Added parameters
- Enhanced
resolveAsyncmethod:- Added parameters
throwError,onError, andonErrorValuefor asynchronous error handling. - Calls
onComputecallback on completion.
- Added parameters
- Added
onComputecallback method invoked once computation completes. - Added
classNamegetter and improvedtoStringto reflect current state (resolving, resolved with value, or error).
- Constructor:
-
Added
TimedComputeOnce<V>subclass:- Records the timestamp when computation resolves (success or failure).
- Provides
resolvedAttimestamp andelapsedTimesince resolution. - Overrides
onComputeto set resolution time. - Overrides
classNamefor identification.
-
-
1.2.1810 Jan 2026Release notes
Open source →-
FutureExtension:- Added method
whenResolvedto invoke a callback on future resolution (success or error) and map the outcome to a new result without automatically rethrowing errors.
- Added method
-
ComputeOnce:- Added method
whenCompleteto register a callback executed when resolution completes, regardless of success or failure. - Added method
whenResolvedto invoke a callback on resolution (success or error) and map the outcome to a new result, delegating toresolveAsyncandFuture.whenResolved.
- Added method
Release notes
Open source →-
FutureExtension:- Added method
whenResolvedto invoke a callback on future resolution (success or error) and map the outcome to a new result without automatically rethrowing errors.
- Added method
-
ComputeOnce:- Added method
whenCompleteto register a callback executed when resolution completes, regardless of success or failure. - Added method
whenResolvedto invoke a callback on resolution (success or error) and map the outcome to a new result, delegating toresolveAsyncandFuture.whenResolved.
- Added method
-
-
1.2.1731 Dec 2025Release notes
Open source →ComputeOnce:- Added typedef
ComputeOnceCall<V>for the computation callback signature. - Changed
_callfield type to nullableComputeOnceCall<V>?and clear it after computation completes to release references and prevent re-invocation.
- Added typedef
Release notes
Open source →ComputeOnce:- Added typedef
ComputeOnceCall<V>for the computation callback signature. - Changed
_callfield type to nullableComputeOnceCall<V>?and clear it after computation completes to release references and prevent re-invocation.
- Added typedef
-
1.2.1631 Dec 2025Release notes
Open source →-
async_extension:- Added export of
src/async_extension_compute_once.dartto library. - New
ComputeOnce.
- Added export of
-
Dependencies:
- Updated
testdependency from ^1.26.0 to ^1.26.3. - Updated
coveragedependency from ^1.13.1 to ^1.15.0.
- Updated
-
Update GitHub Actions to use checkout@v6 and codecov-action@v5.
Release notes
Open source →-
async_extension:- Added export of
src/async_extension_compute_once.dartto library. - New
ComputeOnce.
- Added export of
-
Dependencies:
- Updated
testdependency from ^1.26.0 to ^1.26.3. - Updated
coveragedependency from ^1.13.1 to ^1.15.0.
- Updated
-
Update GitHub Actions to use checkout@v6 and codecov-action@v5.
-
-
1.2.1514 May 2025Release notes
Open source →-
New
FunctionArgs0Extension,FunctionArgs1Extension,FunctionArgs2Extension:- Added
tryCall,tryCallThenandasFutureOr.
- Added
-
test: ^1.26.0
-
dependency_validator: ^4.1.3
-
coverage: ^1.13.1
Release notes
Open source →-
New
FunctionArgs0Extension,FunctionArgs1Extension,FunctionArgs2Extension:- Added
tryCall,tryCallThenandasFutureOr.
- Added
-
test: ^1.26.0
-
dependency_validator: ^4.1.3
-
coverage: ^1.13.1
-
-
1.2.1419 Dec 2024 -
1.2.1318 Dec 2024Release notes
Open source →-
Added
asyncRetry. -
Improved
asyncTrydocumentation. -
lints: ^4.0.0
-
test: ^1.25.13
-
dependency_validator: ^4.1.2
-
coverage: ^1.11.1
Release notes
Open source →-
Added
asyncRetry. -
Improved
asyncTrydocumentation. -
lints: ^4.0.0
-
test: ^1.25.13
-
dependency_validator: ^4.1.2
-
coverage: ^1.11.1
-
-
1.2.1231 Mar 2024Release notes
Open source →-
New
IterableMapEntryFutureValueExtension:- Added
resolveAllValues.
- Added
-
New
IterableMapEntryFutureKeyExtension:- Added
resolveAllKeys.
- Added
-
New
IterableMapEntryFutureExtension:- Added
resolveAllEntries.
- Added
-
-
1.2.1131 Mar 2024 -
1.2.1028 Mar 2024 -
1.2.914 Mar 2024Release notes
Open source →onErrorReturn: added optional parameteronError.nullOnError: added optional parametersonErrorandonErrorOrNull.
-
1.2.814 Mar 2024Release notes
Open source →-
New
AsyncExtensionErrorLoggeranddefaultAsyncExtensionErrorLogger: -
New
FutureOnErrorExtension:logErroronErrorReturnnullOnError
-
FutureNonNullOnErrorExtension:onComplete
-
FutureNullableOnErrorExtension:onCompleteonCompleteNotNull
-
lints: ^3.0.0
-
-
1.2.702 Mar 2024Release notes
Open source →IterableFutureOrNullableExtension:whereFutureNullable,selectFuturesNullable: returnFuture<T?>for consistency with "Nullable" suffix.waitFuturesNullable: returnFutureOr<List<T?>>for consistency with "Nullable" suffix.
-
1.2.602 Mar 2024Release notes
Open source →-
New
extension IterableFutureOrNullableExtension<T> on Iterable<FutureOr<T>?>:whereFutureNullable,selectFuturesNullable,asFuturesNullableandwaitFuturesNullable.
-
test: ^1.25.2
-
dependency_validator: ^3.2.3
-
coverage: ^1.7.2
-
-
1.2.506 Sep 2023Release notes
Open source →- New
ExpandoFutureExtensionandExpandoFutureOrExtension:putIfAbsentAsync
- New
-
1.2.423 Aug 2023Release notes
Open source →- New
FutureOrIterableNullableExtensionandFutureIterableNullableExtension.
- New
-
1.2.323 Aug 2023Release notes
Open source →- New
FutureNullableExtensionandFutureOrNullableExtension:orElseAsyncandorElseGeAsync.
- New
-
1.2.221 Aug 2023Release notes
Open source →FutureOrIterableExtensionandFutureIterableExtension.- Use suffix
Asyncto avoid extension overwrite issues.
- Use suffix
-
1.2.121 Aug 2023Release notes
Open source →- New
FutureOrIterableExtensionandFutureIterableExtension. - test: ^1.24.6
- New
-
1.2.003 Aug 2023 -
1.1.120 Jun 2023Release notes
Open source →-
Optimize:
resolveMapped,resolveAllValuesNullable.resolveAllValues,resolveAllValuesNullable,resolveAllKeys,resolveAllEntries.
-
sdk: '>=2.18.0 <4.0.0'
-
test: ^1.24.3
-
-
1.1.009 Feb 2023Release notes
Open source →- Fix GitHub CI badge.
- sdk: '>=2.18.0 <3.0.0'
- lints: ^2.0.1
- test: ^1.23.0
- coverage: ^1.6.3
-
1.0.1206 Aug 2022Release notes
Open source →asyncTry:- Fix issue when
onErrorreturns aFuturewith a type different from the main function.
- Fix issue when
-
1.0.1106 Aug 2022Release notes
Open source →AsyncLoop:- Added
AsyncLoop.forEach. - Optimize
_runBodyto avoid recursion.
- Added
asyncTry:- Fix behavior when an error is rethrown inside an
onErrorblock. - Fix behavior when an error is thrown inside an
onFinallyblock. - Ensures the same behavior of standard Dart
try/catchblocks.
- Fix behavior when an error is rethrown inside an
-
1.0.1030 Jul 2022Release notes
Open source →FutureExtensionandFutureOrExtension:- Renamed
typegetter togenericTypeto avoid issues with nullable variables.
- Renamed
- Update GitHub CI.
- lints: ^2.0.0
- test: ^1.17.12
- dependency_validator: ^3.2.2
- coverage: ^1.0.4
-
1.0.915 Oct 2021Release notes
Open source →whereNotNullrenamed towhereNotNullSyncto avoid conflict with packagecollection.
-
1.0.810 Oct 2021Release notes
Open source →- Added
asyncTry:- Executes a
blockin atry,then,catchandfinallyexecution chain.
- Executes a
- Using standard Dart coverage.
- coverage: ^1.0.3
- Added
-
1.0.722 Sep 2021Release notes
Open source →- New extension methods:
resolveOtherresolveAllNullable
- New
Mapextension methods:resolveAllKeysresolveAllEntriesresolveAllValuesresolveAllValuesNullable
- New extension methods:
-
1.0.617 Sep 2021Release notes
Open source →- New extension methods for nullable types:
whereNotNullwhereNotNullResolvedresolveAllNotNull
- Fixed
isResolveddetection for whenTisObjectordynamic.
- New extension methods for nullable types:
-
1.0.513 Sep 2021Release notes
Open source →- The package now exports
dart:async. - New extensions:
- resolveWithValue
- resolveAllWithValue
- resolveAllThen
- allAsList
- Optimized some resolutions
- Now ensures that iterables won't be iterated more than once.
- Ensures that
ListandSetwon't be converted toListwhen not needed.
- The package now exports
-
1.0.430 Jun 2021 -
1.0.330 Jun 2021 -
1.0.229 Jun 2021Release notes
Open source →- Added
resolveBothforFutureOrandFuture. - Add
FutureandFutureOrarithmetic operators. - Added Benchmarks:
async_extension_benchmark.dartasync_extension_benchmark2.dart
- Added
-
1.0.128 Jun 2021 -
1.0.028 Jun 2021