Bloc: Would need some help, updating from 0.7.1

Created on 2 Aug 2019  路  4Comments  路  Source: felangel/bloc

I have one bit older flutter project I started to look into again and wanted to update into the latest version, however there seems to be a breaking change between 0.8.0 and 0.9.0 but I didn't find any docs about it what it could be?

Happy to provide further examples but not too sure what would be needed in this case

Example:

error: 'ActivityBloc.mapEventToState' ('Stream<ActivityState> Function(ActivityEvent, dynamic)') isn't a valid override of 'Bloc.mapEventToState' ('Stream<ActivityState> Function(ActivityEvent)'). (invalid_override at [appname] lib/bloc/activity_bloc.dart:42)

question

Most helpful comment

@felangel thank you so much! Both from the prompt reply and awesome support, you made my day :).

All 4 comments

Hi @Luppakorva 馃憢
Thanks for opening an issue! Can you provide a link to the repo or the snippet of activity_bloc.dart?

@Luppakorva the mapEventToState signature changed to not have a currentState passed as a parameter since you can already access currentState from anywhere in the bloc.

You should just be able to change

Stream<ActivityState> mapEventToState(currentState, event) async* {
  ...
}

to

Stream<ActivityState> mapEventToState(event) async* {
  ...
}

@felangel thank you so much! Both from the prompt reply and awesome support, you made my day :).

Was this page helpful?
0 / 5 - 0 ratings