UserContextProvider class

Lightweight user/session context. Keep PII to a minimum by default. If you need to include sensitive traits, a sanitizer in your privacy pipeline should mask/strip them before sending.

Inheritance

Constructors

UserContextProvider({String? id, String? email, String? role, String? tenantId, Map<String, dynamic> traits = const {}, bool manualOnly = false})
Creates a user context provider that exposes lightweight identifiers and traits, optionally limiting collection to manual reports.

Properties

email → String?
Primary email address associated with the user, when safe to expose.
final
hashCode → int
The hash code for this object.
no setterinherited
id → String?
Stable identifier for the current user, if available.
final
manualReportOnly → bool
When true, user context is included only in user-initiated reports.
no setteroverride
name → String
The key under which this provider's map is attached to the report context.
no setteroverride
role → String?
Access level or role label used for authorization decisions.
final
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
tenantId → String?
Multi-tenant scope identifier for the user/session.
final

Methods

getData() → Map<String, dynamic>
Collects context data. Implementations must never throw; if an internal error occurs, return an empty map instead.
override
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() → String
A string representation of this object.
inherited
validateData(Map<String, dynamic> data) → bool
Optional validation; return true to keep the data in the report. The default keeps any non‑empty map.
inherited

Operators

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