AppContextProvider class
Provides application/package metadata + lightweight runtime signals that are safe to collect automatically (network summary, battery level).
Avoids UI/BuildContext to keep it usable at app startup and in isolates.
- Inheritance
-
- Object
- ContextProvider
- AppContextProvider
- Mixed-in types
Constructors
-
AppContextProvider({PackageInfo? packageInfo, Battery? battery, Connectivity? connectivity, Map<
String, dynamic> additional()?}) - Creates an app context provider with optional injected dependencies and a hook for attaching additional custom metadata.
Properties
- cacheDuration → Duration
-
Cache TTL for this provider. Keep short for dynamic data, longer for static.
no setteroverride
- 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 setterinherited
- name → String
-
The key under which this provider's map is attached to the report context.
no setteroverride
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
clearCache(
) → void -
Clears the cached value, forcing the next call to hit collect.
inherited
-
collect(
) → Future< Map< String, dynamic> > -
Override this instead of getData to implement the actual data collection.
override
-
getData(
) → Future< Map< String, dynamic> > -
Collects context data. Implementations must never throw; if an internal
error occurs, return an empty map instead.
inherited
-
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
trueto keep the data in the report. The default keeps any non‑empty map.inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited