Bloc: [Question] debounceTime In Cubit

Created on 17 Aug 2020  路  2Comments  路  Source: felangel/bloc

Hello @felangel .

On the Bloc, in search mode I overide the transformation event like this

return super.transformEvents (
events.debounceTime (const Duration (milliseconds: 500)),
transitionFn,
);

now I am using Cubit, currently in my Ui layer i have this

Timer _debounce;
_onSearchChanged () {
if (_debounce? .isActive ?? false) _debounce.cancel ();
_debounce = Timer (const Duration (milliseconds: 500), () {
// do something with MyCubit
});
}`
I ask for your best and most effective advice.

Thank You.

question

Most helpful comment

Hi @docmobile17 馃憢

For more advanced functionality like debouncing it is recommended to swap cubit for bloc, since it's pretty trivial to acomplish this in transformEvents, like you already mentioned. 馃憤

Ok, Thank's for your advice @felangel and @RollyPeres 馃憤

All 2 comments

Hi @docmobile17 馃憢

For more advanced functionality like debouncing it is recommended to swap cubit for bloc, since it's pretty trivial to acomplish this in transformEvents, like you already mentioned. 馃憤

Hi @docmobile17 馃憢

For more advanced functionality like debouncing it is recommended to swap cubit for bloc, since it's pretty trivial to acomplish this in transformEvents, like you already mentioned. 馃憤

Ok, Thank's for your advice @felangel and @RollyPeres 馃憤

Was this page helpful?
0 / 5 - 0 ratings