Created
September 8, 2022 09:24
-
-
Save karabanovbs/87b7fa0bc4a47b79cc0c7a74ca3fbf63 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'dart:async'; | |
import 'package:flutter_test/flutter_test.dart'; | |
void main() { | |
test('test case', () async { | |
await expectLater( | |
// create stream that emit Completer, and wait it | |
((() async* { | |
try { | |
final completer = Completer<void>(); | |
yield completer; | |
await completer.future; | |
} catch (_) { | |
// handle error | |
} | |
})()) | |
.map((event) { | |
// add error to completer | |
event.completeError(Exception()); | |
return event; | |
}), | |
emitsThrough(anything), | |
); | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment