-
Notifications
You must be signed in to change notification settings - Fork 62
Closed
Labels
closed-as-intendedClosed as the reported issue is expected behaviorClosed as the reported issue is expected behaviorpackage:clock
Description
Using a StreamController
with an addTearDown
to close the stream within withClock
freezes the test.
If I remove the addTeardown
the test finishes.
Here is a small example:
testWidgets('description', (tester) async {
await withClock(Clock.fixed(DateTime(2025)), () async {
final controller = StreamController<DateTime?>();
addTearDown(() async {
print('Before');
await controller.close();
print('After');
});
final widget = MaterialApp(home: Text(clock.now().toString()));
await tester.pumpWidget(widget);
expect(find.text('2025-01-01 00:00:00.000'), findsOneWidget);
print('End');
});
});
Output:
End
Before
Metadata
Metadata
Assignees
Labels
closed-as-intendedClosed as the reported issue is expected behaviorClosed as the reported issue is expected behaviorpackage:clock