Upgrading flutter_bloc 5 to 6
Breaking5.0.1 → 6.1.3Breaking5Deprecated2New5Changed6Fixed5Other9
BreakingUpgrade verdict
5 breaking changes.
In plain terms
- If you pass a cubit to BlocBuilder, the argument is now called cubit instead of bloc.
- If you pass a cubit to BlocListener, the argument is now called cubit instead of bloc.
- If you pass a cubit to BlocConsumer, the argument is now called cubit instead of bloc.
- This version needs the newer 6.x core bloc package to work.
Must act Top 5 of 7 that need code or config changes
What you must change
Breaking5
Renames the BlocBuilder bloc parameter to cubit for cubit interop.
BlocBuilderRenames the BlocListener bloc parameter to cubit for cubit interop.
BlocListenerRenames the BlocConsumer bloc parameter to cubit for cubit interop.
BlocConsumerUpgrades the required bloc dependency to ^6.0.0.
Upgrades the bloc dependency to ^6.0.0-dev.1.
Deprecations to plan for
Deprecated2
Deprecates
context.bloc in favor of context.read and context.watch.context.bloccontext.readcontext.watchDeprecates
context.repository in favor of context.read and context.watch.context.repositorycontext.readcontext.watch