<itemvalue="A way to produce Future objects and to complete them later with a value or error. Most of the time, the simplest way to create a future is to just use one of the [Future] constructors to capture the result of a single asynchronous computation: ```dart Future(() { doSomething(); return result; }); ``` or, if the future represents the result of a sequence of asynchronous computations, they can be chained using [Future.then] or similar functions on [Future]: ```dart Future doStuff(){ return someAsyncOperation().then((result) { return someOtherAsyncOperation(result); }); } ``` If you do need to create a Future from scratch — for example, when you're converting a callback-based API into a Future-based one — you can use a Completer as follows: ```dart class AsyncOperation { final Completer _completer = new Completer(); Future<T> doOperation() { _startOperation(); return _completer.future; Send future object back to client. } Something calls this when the value is ready. void _finishOperation(T result) { _completer.complete(result); } If something goes wrong, call this. void _errorHappened(error) { _completer.completeError(error); } } ```"/>
<itemvalue="A way to produce Future objects and to complete them later with a value or error. Most of the time, the simplest way to create a future is to just use one of the [Future] constructors to capture the result of a single asynchronous computation: ```dart Future(() { doSomething(); return result; }); ``` or, if the future represents the result of a sequence of asynchronous computations, they can be chained using [Future.then] or similar functions on [Future]: ```dart Future doStuff(){ return someAsyncOperation().then((result) { return someOtherAsyncOperation(result); }); } ``` If you do need to create a Future from scratch — for example, when you're converting a callback-based API into a Future-based one — you can use a Completer as follows: ```dart class AsyncOperation { final Completer _completer = new Completer(); Future<T> doOperation() { _startOperation(); return _completer.future; Send future object back to client. } Something calls this when the value is ready. void _finishOperation(T result) { _completer.complete(result); } If something goes wrong, call this. void _errorHappened(error) { _completer.completeError(error); } } ```"/>
<itemvalue="Creates a new completer. The general workflow for creating a new future is to 1) create a new completer, 2) hand out its future, and, at a later point, 3) invoke either [complete] or [completeError]. The completer completes the future asynchronously. That means that callbacks registered on the future are not called immediately when [complete] or [completeError] is called. Instead the callbacks are delayed until a later microtask. Example: ```dart var completer = new Completer(); handOut(completer.future); later: { completer.complete('completion value'); } ```"/>
<itemvalue="Creates a new completer. The general workflow for creating a new future is to 1) create a new completer, 2) hand out its future, and, at a later point, 3) invoke either [complete] or [completeError]. The completer completes the future asynchronously. That means that callbacks registered on the future are not called immediately when [complete] or [completeError] is called. Instead the callbacks are delayed until a later microtask. Example: ```dart var completer = new Completer(); handOut(completer.future); later: { completer.complete('completion value'); } ```"/>
<itemvalue="Loads the specified image with [fileName] into the cache. By default the key in the cache is the [fileName], if another key is desired, specify the optional [key] argument."/>
<itemvalue="Loads the specified image with [fileName] into the cache. By default the key in the cache is the [fileName], if another key is desired, specify the optional [key] argument."/>