ContextProvider class abstract

Base contract for providing structured diagnostic context that can be attached to error/report events.

Providers should be:

  • Fast and resilient (never throw out of getData).
  • Conscious about privacy (avoid PII by default).
  • Lightweight by default; heavy data should be opt‑in or manual‑only.
Implementers
Annotations

Constructors

ContextProvider()
Allows subclasses to be const and satisfy immutability lint rules.
const

Properties

hashCode → int
The hash code for this object.
no setterinherited
manualReportOnly → bool
If true, this context is collected only for manual user‑initiated reports (e.g., when the user taps "Send diagnostics"), and not for automatic background reporting.
no setter
name → String
The key under which this provider's map is attached to the report context.
no setter
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited

Methods

getData() → FutureOr<Map<String, dynamic>>
Collects context data. Implementations must never throw; if an internal error occurs, return an empty map instead.
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.

Operators

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