AdapterManager class

Manages all registered adapters in the Air Framework.

Adapters are infrastructure-level services (HTTP, analytics, error tracking) that are registered before modules. This ensures that modules can safely depend on adapter-provided services through AirDI.

Boot Order

Adapters (AdapterManager) → Modules (ModuleManager) → App

Example

void main() async {
  WidgetsFlutterBinding.ensureInitialized();
  configureAirState();

  // 1. Infrastructure adapters first
  await AdapterManager().register(DioAdapter(baseUrl: 'https://api.example.com'));
  await AdapterManager().register(SentryAdapter(dsn: '...'));

  // 2. Feature modules second (can use adapter services)
  await ModuleManager().register(AuthModule());
  await ModuleManager().register(HomeModule());

  runApp(const MyApp());
}
Inheritance

Constructors

AdapterManager()
Factory constructor to access the global instance of AdapterManager.
factory

Properties

adapters → List<AirAdapter>
Get all registered adapters (unmodifiable)
no setter
debugAdapterInfo → List<Map<String, String>>
Returns debug info for all adapters (used by DevTools)
no setter
hashCode → int
The hash code for this object.
no setterinherited
hasListeners → bool
Whether any listeners are currently registered.
no setterinherited
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited

Methods

addListener(VoidCallback listener) → void
Register a closure to be called when the object changes.
inherited
dispose() → void
Discards any resources used by the object.
inherited
getAdapter(String id) → AirAdapter?
Get an adapter by its ID
isInitialized(String adapterId) → bool
Check if an adapter is fully initialized
isRegistered(String adapterId) → bool
Check if an adapter is registered
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
notifyListeners() → void
Call all the registered listeners.
inherited
register(AirAdapter adapter) → Future<void>
Register an adapter with full lifecycle management.
removeListener(VoidCallback listener) → void
Remove a previously registered closure from the list of closures that are notified when the object changes.
inherited
reset() → Future<void>
Clear all adapters (for testing).
toString() → String
A string representation of this object.
inherited
unregister(String adapterId) → Future<void>
Unregister an adapter with proper cleanup.

Operators

operator ==(Object other) → bool
The equality operator.
inherited