expectRxNoChange<T> static method
Test that an Rx value does not change within a duration
Implementation
static Future<void> expectRxNoChange<T>(
Rx<T> rx,
Duration duration,
) async {
final initialValue = rx.value;
bool changed = false;
void listener() {
if (rx.value != initialValue) {
changed = true;
}
}
rx.addListener(listener);
await Future.delayed(duration);
rx.removeListener(listener);
if (changed) {
throw Exception(
'Expected Rx value to remain $initialValue but it changed to ${rx.value}');
}
}