DeviceService class

App-facing device facade.

final device = DeviceService();
final info = await device.info();
final online = (await device.status()).isOnline;
device.onAppLifecycle((state) { /* cache flush on paused */ });

Constructors

DeviceService({DevicePort? port})

Properties

hashCode → int
The hash code for this object.
no setterinherited
isOnline → Future<bool>
Whether the device is currently online.
no setter
lifecycle → AppLifecycleState2
The current app lifecycle state.
no setter
port → DevicePort
The platform adapter (or the in-memory default in tests).
final
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited

Methods

info() → Future<DeviceInfo>
Static device/environment info.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
onAppLifecycle(void listener(AppLifecycleState2 state)) → void Function()
Subscribes to lifecycle changes; returns the unsubscribe function.
status() → Future<DeviceStatus>
Current connectivity + power status.
toString() → String
A string representation of this object.
inherited

Operators

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