prefer-correct-bloc-provider
added in: 1.2.0
warning
Warns when a Bloc
is provided not with a BlocProvider
.
If you use both bloc
and provider
packages it becomes easy to accidentally use a wrong Provider
for your Blocs
.
Example
❌ Bad:
final provider = Provider<BlocA>(
create: (context) => BlocA(),
child: Widget(),
);
✅ Good:
final blocProvider = BlocProvider<BlocA>(
create: (context) => BlocA(),
child: Widget(),
);