bootstrapHeadless static method

Future<ZenithTenantScope> bootstrapHeadless({
  1. required String tenantId,
  2. Object? storageFactory(
    1. String tenantId
    )?,
})

Creates a minimal headless ZenithTenantScope for background isolates or Workmanager tasks — does not require Flutter bindings.

Implementation

static Future<ZenithTenantScope> bootstrapHeadless({
  required String tenantId,
  Object? Function(String tenantId)? storageFactory,
}) async {
  final scope = ZenithTenantScope(tenantId);
  if (storageFactory != null) {
    final storage = storageFactory(tenantId);
    if (storage != null) {
      scope.container.getOrCreate(
        ZenithKey<Object>('__headless_storage__'),
        (_) => storage,
      );
    }
  }
  return scope;
}