Skip to main content
Archery service providers divide setup into registration and boot phases; you will package bindings and startup work without hiding application order.

Implement a provider

Override register() for service bindings. Override boot() for asynchronous work that may resolve services after all providers have registered.
lib/src/providers/aws/s3_client_provider.dart

Register providers

Add a provider directly with app.register() or organize providers with app.registerGroup().
example/main.dart
Archery invokes a provider’s register() when you add it. During boot(), it initializes eager container services and then invokes each provider’s boot() method. Registering the same provider instance twice raises ProviderException.duplicateRegistration.

React to startup and shutdown

Register a synchronous post-boot callback with onBooted(). Use container disposal callbacks for resources that must close when App.shutdown() runs.
lib/src/bootstrap.dart
Keep register() focused on bindings. Put migrations, network initialization, and other asynchronous startup operations in boot().