better_future 1.0.0 copy "better_future: ^1.0.0" to clipboard
better_future: ^1.0.0 copied to clipboard

Advanced asynchronous orchestration with named results, dependency management, and automatic cleanup.

example/main.dart

import 'package:better_future/better_future.dart';

void main() async {
  print('--- Basic BetterFuture Example ---');

  final locale = 'fr';

  final results = await BetterFuture.wait({
    // A simple independent computation
    'greeting': () => switch (locale) {
      'fr' => 'Bonjour',
      _ => 'Hello',
    },

    // A computation depending on another result
    'message': ($) async {
      final base = await $.greeting<String>();
      return '$base BetterFuture!';
    },

    // A task running in parallel
    'timestamp': ($) => DateTime.now(),
  });

  print('Greeting: ${results['greeting']}');
  print('Full Message: ${results['message']}');
  print('Computed at: ${results['timestamp']}');
}
0
likes
0
points
147
downloads

Publisher

verified publisherd-markey.ovh

Weekly Downloads

Advanced asynchronous orchestration with named results, dependency management, and automatic cleanup.

Repository (GitHub)
View/report issues

Funding

Consider supporting this project:

github.com

License

unknown (license)

More

Packages that depend on better_future