Bloc: Why BLoC constructor must have a super declared

Created on 4 Jul 2020  路  3Comments  路  Source: felangel/bloc

After updating to flutter_bloc: ^5.0.0 I got errors on my whole 30 blocs tells me to declare a super:

The superclass 'Bloc' doesn't have a zero argument constructor. Try declaring a zero argument constructor in 'Bloc', or explicitly invoking a different constructor in 'Bloc'.

Should I update every constructor manually, or this is just a bug?

question

All 3 comments

Hi @wailashraf71 馃憢
Thanks for opening an issue!

This is not a bug. In v5.0.0 initialState was removed in favor of passing the initial state to super. Check out the migration guide for more information 馃憤

Oh, now I see thank you! hope you add the migration guide to the package on pub.dev change log馃槃

@wailashraf71 yup I can add it to the changelog 馃憤
It鈥檚 also on the home page at bloclibrary.dev.

Was this page helpful?
0 / 5 - 0 ratings