buildAnonymousContext function

Future<EvalContext> buildAnonymousContext(
  1. FeatStorage storage
)

Build a stable anonymous EvalContext. A UUID is minted on first use and persisted through storage so the same install lands in the same targeting bucket across restarts. When storage is an InMemoryStorage (the default), the key is stable only for the process lifetime.

The resulting shape mirrors the other feat SDKs: { targetingKey: uuid, user: { key: uuid, anonymous: true } }.

Implementation

Future<EvalContext> buildAnonymousContext(FeatStorage storage) async {
  final key = await _resolveOrMintKey(storage);
  return EvalContext.user(key, anonymous: true);
}