Stream に流れる値の検証
Stream に流れる値を検証したいとき
class ProfileViewModel {
final StreamController<String> _body = StreamController.broadcast();
Stream<String> get body => _body.stream;
void onBodyEdited(String body) {
_body.add(body);
}
}Recipe
expectLater
test('test', () {
final viewModel = ProfileViewModel();
expectLater(viewModel.body, emits('body'));
viewModel.onBodyEdited('body');
});expectAsync
Result
最終更新