future<T> static method
Creates a FutureBeacon that initializes its value based on a future.
The beacon can optionally depend on another ReadableBeacon.
If manualStart is true, the future will not execute until start() is called.
Example:
var myBeacon = Beacon.future(() async {
return await Future.delayed(Duration(seconds: 1), () => 'Hello');
});
myBeacon.subscribe((value) {
print(value); // Outputs 'Hello' after 1 second
});
Implementation
static FutureBeacon<T> future<T>(
Future<T> Function() future, {
bool manualStart = false,
}) {
return FutureBeacon<T>(future, manualStart: manualStart);
}