UiAdapterRegistry class

Central registry for remote backend UI adapters.

Manages a collection of RemoteUiAdapter instances and provides:

  • Single source of truth for configured remote backends
  • Query methods for active/authenticated remotes
  • UI integration point for multi-backend status widgets

Usage Pattern

The registry is created automatically by Locorda.create when you provide remote integrations:

// 1. Initialize auth for remote backends
final solidAuth = SolidAuth(...);
await solidAuth.init();
final gdriveAuth = await GDriveAuth.create();

// 2. Create Locorda with remote handlers
final locorda = await Locorda.create(
  remotes: [
    SolidMainIntegration(solidAuth: solidAuth),
    GDriveMainIntegration(gdriveAuth: gdriveAuth),
  ],
  storage: DriftMainHandler(),
  config: locordaConfig,
  mapperInitializer: myMapperInitializer,
  workerSetup: setupWorkerEngine,
);

// 3. Access registry via Locorda instance
final registry = locorda.uiAdapterRegistry;

// 4. Use in UI for multi-backend auth status
AppBar(
  actions: [
    // Build custom UI using registry.remoteAdapters
    for (final adapter in registry.remoteAdapters)
      // ... auth button for adapter ...
  ],
)

Manual Creation

You can also create a registry manually for testing or advanced use cases:

final registry = UiAdapterRegistry.withRemotes([
  SolidMainIntegration(solidAuth: solidAuth),
  GDriveMainIntegration(gdriveAuth: gdriveAuth),
]);

Constructors

UiAdapterRegistry.withRemotes(List<RemoteUiAdapter> remoteAdapters)
Creates a registry with the given remote UI adapters.

Properties

activeRemote RemoteUiAdapter?
The currently active (authenticated) remote adapter.
no setter
authenticatedRemotes List<RemoteUiAdapter>
All remote adapters that are currently authenticated.
no setter
hashCode int
The hash code for this object.
no setterinherited
remoteAdapters List<RemoteUiAdapter>
All registered remote UI adapters (immutable view).
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

findByRemoteId(String id) RemoteUiAdapter?
Finds remote adapter by unique identifier.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

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