DeviceContextProvider class

Provides device/OS/runtime information. Data is intentionally scoped to what is helpful for diagnostics and safe for privacy by default.

Inheritance
Mixed-in types

Constructors

DeviceContextProvider({DeviceInfoPlugin? deviceInfo})
Creates a device context provider, allowing dependency injection for testing by supplying a custom DeviceInfoPlugin instance.

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 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