kranfix / riverbloc

`flutter_bloc` implemented with `riverpod` instead of `provider`.
83 stars 17 forks source link

Remove scoped - riverpod has all providers with scoped default #76

Open user97116 opened 2 years ago

kranfix commented 2 years ago

Yes and no.

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.