Closed BrianMwas closed 4 years ago
try adding the type of the stream PropertyFormState. @override Stream < PropertyFormState > mapEventToState( PropertyFormEvent event, ) async { yield event.map(
Thanks I tried it and found out I had not added yield to the event. Thanks for this
Hi I have been trying to find out the problem for a whole two days and I still haven't found what the problem is When writing the property_form_bloc with initialNote the state does not update no matter what I do here's the code
`class PropertyFormBloc extends Bloc<PropertyFormEvent, PropertyFormState> { final IPropertyFacade _propertyFacade; PropertyFormBloc(this._propertyFacade) : super(PropertyFormState.initial());
@override Stream mapEventToState(
PropertyFormEvent event,
) async {
yield event.map(
initialized: (e) async {
e.initialPropertyOption.fold(
() => state,
(initialProperty) => state.copyWith(
isEditing: true,
property: initialProperty
)
);
print("current state is now $state");
},
nameChanged: (e) async {
print("name changed ${e.name}");
yield state.copyWith(
property: state.property.copyWith(name: PropertyName(e.name)),
saveFailureOrSuccessOption: none()
);
},
descriptionEvent: (e) async {
yield state.copyWith(
property: state.property.copyWith(description: e.description),
saveFailureOrSuccessOption: none()
);
},
saved: (e) async {
Either<ClassFailure, String> failureOrSuccess;
} }` Am I missing something? When I log out the initial property in this case it logs out the initialPropertyOption but is unable to update the state. Any answer is welcome