Upgrading flutter_bloc 6 to 7
Breaking6.1.3 → 7.3.3Breaking14New3Changed12Fixed4Other6
BreakingUpgrade verdict
12 breaking changes.
In plain terms
- If you passed a cubit to these widgets using the named `cubit` argument, you now need to use `bloc` instead.
- Code that read a repository from the build context via `context.repository` no longer works.
- The package no longer depends on Flutter, which can affect projects that relied on that transitive dependency.
- Access storage through HydratedBloc.storage instead of HydratedCubit.storage.
Must act Top 3 of 12 that need code or config changes
Dart SDK requirement changed in 7.0.1: >=2.6.0 <3.0.0 → >=2.12.0 <3.0.0.
What you must change
Breaking12
Renames the
cubit parameter to bloc in BlocListener, BlocBuilder, and BlocConsumer.BlocListenerBlocBuilderBlocConsumercubitblocRemoves the deprecated
context.repository extension.context.repositoryRemoves the flutter dependency.
flutterRemoves HydratedCubit.storage in favor of HydratedBloc.storage.
HydratedCubit.storageHydratedBloc.storageRemoves the context.bloc extension.
context.blocRenames the cubit parameter in BlocListener to value.
BlocListenercubitvalueRenames the cubit parameter in BlocBuilder to value.
BlocBuildercubitvalueRenames the cubit parameter in BlocConsumer to value.
BlocConsumercubitvalueRemoves the dependency on package:provider.
package:providerOpts into null safety.
Requires storageDirectory when calling HydratedStorage.build.
HydratedStorage.buildstorageDirectoryReverts the changes from version 7.0.0-dev.1.