1
🔁 Retry & Time Control
Future<T>
int
required
The total number of attempts to make before giving up.
Future a specified number of times upon failure. Essential for handling transient network errors.Future<T>
2
Documentation Index
Fetch the complete documentation index at: /llms.txt
Use this file to discover all available pages before exploring further.
🚀 Flutter_Extend Version 0.3.0 is now live! See our changelog for details.
Essential utilities for mastering asynchronous code: implement automatic retries, set fallbacks for timeouts, and manage execution delays.
Future a specified number of times upon failure. Essential for handling transient network errors.// Retries the network call up to 3 times
final data = await fetchUserData().retry(3, delay: 1.seconds);
fallbackValue to return if the Future fails to complete in time.// Returns 0 if the computation takes longer than 5 seconds.
final result = await complexCalculation()
.timeoutWithFallback(Duration(seconds: 5), 0);
delay before starting the execution of this Future. Useful for simulating network latency in dev/testing.// Simulate a slow network with a 2-second minimum delay.
final data = await fetchSettings().runAfterDelay(Duration(seconds: 2));
Future has completed (either successfully or with an error). Note: This method starts the Future execution if it hasn’t begun.final myFuture = Future.delayed(Duration(seconds: 2), () => 42);
print(myFuture.isComplete()); // false (initially)
Future inside a Completer. An internal utility for managing Future state within other asynchronous flows.final completer = someFuture.wrapInCompleter();
Was this page helpful?
