extensions 0.3.8 copy "extensions: ^0.3.8" to clipboard
extensions: ^0.3.8 copied to clipboard

outdated

A set of APIs for commonly used programming patterns and utilities, such as dependency injection, logging, and configuration.

example/example.dart

// import 'package:extensions/hosting.dart';
// import 'package:extensions/src/hosting/hosting_host_builder_extensions_io.dart';

// Future<void> main(List<String> args) async =>
//     await Host.createDefaultBuilder(args)
//         .configureServices(
//           (_, services) => services.addHostedService<ExampleHostedService>(
//             (services) => ExampleHostedService(
//               services
//                   .getRequiredService<LoggerFactory>()
//                   .createLogger('ExampleHostedService'),
//               services.getRequiredService<HostApplicationLifetime>(),
//             ),
//           ),
//         )
//         .useConsoleLifetime(null)
//         .build()
//         .run();

// class ExampleHostedService extends HostedService {
//   final Logger _logger;

//   ExampleHostedService(
//     Logger logger,
//     HostApplicationLifetime lifetime,
//   ) : _logger = logger {
//     lifetime
//       ..applicationStarted.register((_) => _onStarted())
//       ..applicationStopping.register((_) => _onStopping())
//       ..applicationStopped.register((_) => _onStopped());
//   }

//   @override
//   Future<void> start(CancellationToken cancellationToken) async {
//     _logger.logInformation('1. Start has been called.');
//     return;
//   }

//   @override
//   Future<void> stop(CancellationToken cancellationToken) async {
//     _logger.logInformation('4. Stop has been called.');
//     return;
//   }

//   void _onStarted() {
//     _logger.logInformation('2. OnStarted has been called.');
//   }

//   void _onStopping() {
//     _logger.logInformation('3. OnStopping has been called.');
//   }

//   void _onStopped() {
//     _logger.logInformation('5. OnStopped has been called.');
//   }
// }
1
likes
0
pub points
52%
popularity

Publisher

verified publisherjamiewest.dev

A set of APIs for commonly used programming patterns and utilities, such as dependency injection, logging, and configuration.

Repository
View/report issues

License

unknown (license)

Dependencies

async, characters, collection, path, tuple, uuid, watcher

More

Packages that depend on extensions