To create a scoped BlocProvider, the code is the following:
final counterCubitProvider = BlocProvider\<CounterCubit, int>(
(ref) => throw UnimplementedError('counterCubitProvider must be overriden'),
name: 'counterCubitProvider'
);
But it is too long. Then, it can be rewritten as follows:
final counterCubitProvider = BlocProvider<CounterCubit, int>.scoped('counterCubitProvider');
It is only a helper constructor because I'm tired of the boilerplate, but it is not bases on the deprecated ScopedProvider.
But thanks for make me notice the ambiguity. I'll rename it as BlocProvider.unimplemented.
Yes and no.
To create a scoped
BlocProvider
, the code is the following:But it is too long. Then, it can be rewritten as follows:
It is only a helper constructor because I'm tired of the boilerplate, but it is not bases on the deprecated
ScopedProvider
.But thanks for make me notice the ambiguity. I'll rename it as
BlocProvider.unimplemented
.