Is this supposed to be yield instead of state =?
if (event is ConfirmOrderEvent) {
var state = currentState.copyWith(isLoading: true);
yield state;
final orderRequest = state.orderRequestBuilder.build();
try {
await this.orderDataSource.submitOrder(orderRequest);
yield state.copyWith(success: true);
} on AppError catch (error) {
state = state.copyWith(isLoading: false, error: error);
} catch (exception) {
print(exception);
}
}
if (event is SaveCouponInOrderStateEvent) {
yield currentState.copyWith(
isCouponValid: event.isCouponValid,
coupon: event.coupon,
category: event.category);
}
There's no yield after that, so leaving is as is won't cause any changes. I changed it in my code.