FfiFlutterInactiveTimer class
An implementation of FlutterInactiveTimerPlatform that reads the Idle
duration through dart:ffi instead of a method channel (ADR-0004).
Not the default yet. FlutterInactiveTimerPlatform.instance still resolves to the method-channel implementation; this class is built and verified alongside it so the two can be compared on a real machine before either is retired. Switching the default is a separate change.
The getIdleDuration override is async only because the platform
interface says so — the read underneath is a synchronous OS call. That
distinction matters more than it looks: the method-channel path suspends at
an await, which is where four bugs in this package's history came from
(docs/agents/lessons.md). Here nothing is read after a suspension point,
because there is no suspension point. If you ever add one, the shell's
generation check is what has to be revisited.
- Inheritance
-
- Object
- FlutterInactiveTimerPlatform
- FfiFlutterInactiveTimer
Constructors
- FfiFlutterInactiveTimer({IdleSource? source})
-
Creates an FFI-backed platform reading from
source, defaulting to the host's own source. Tests inject their own rather than reaching the OS.
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- source → IdleSource
-
The source this platform reads from — exposed so the parity harness can
label which binding produced a value.
final
Methods
-
getIdleDuration(
) → Future< int> -
Milliseconds since the user's last keyboard or mouse input, computed per
platform and returned as a single value. See ADR-0001.
override
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited