testing library

Test doubles for apps that use flutter_device_ai.

FlutterDeviceAiPlatform.instance = FakeOnDeviceAiPlatform(
  responder: (prompt, history) => 'Echo: $prompt',
);

Classes

FakeOnDeviceAiEmbedder
Deterministic embedder for tests: hashes words into a fixed-size bag-of-words vector, so texts sharing words score as similar. It is a test double, not a language model; never ship it.
FakeOnDeviceAiPlatform
In-memory platform implementation for unit and widget tests.
FakeSession
State of one fake conversation.

Typedefs

FakeResponder = FutureOr<String> Function(String prompt, List<String> transcript)
Computes the model's reply from the latest user text and the transcript (User: ... / Assistant: ... lines, oldest first).