Bloc: Question: Tab Change BlocBuilder Even with AutomaticKeepAliveClientMixin

Created on 20 Jun 2020  路  3Comments  路  Source: felangel/bloc

I wish to ask since there is no posting in any closed issues
Tab changes with no rebuild happen if you apply AutomaticKeepAliveClientMixin.

However, when I integrate BlocBuilder it keeps rebuilding when i change tab. And no, it's not because condition property is called. It does not get called. it goes right ahead to rebuilding the widget again.

Thoughts?

question

Most helpful comment

i think i get your point. probably because on tab change i call setState to keep track of the tab controller status

hence the rebuild. closing this.

All 3 comments

Hi @chitgoks 馃憢

AutomaticKeepAliveClientMixin doesn't affect rebuilding, all it does in your case is making sure the widget doesn't get disposed when switching tabs.

BlocBuilder is not responsible for rebuilds triggered by flutter itself, which is the case when you're switching tabs.

Hope that helps 馃憤

hi rolly thank you for getting back. much appreciated.

using AutomaticKeepAliveClientMixin without blocbuilder, works. the widget does not rebuild when switching tabs. putnin some print() in build and it doesnt print so it works.

im confused why when i insert BlocBuilder it rebuilds. this looks like its all flutter but hopefully can shed light why it behaves like this wyen blocbuildet is used?

i think i get your point. probably because on tab change i call setState to keep track of the tab controller status

hence the rebuild. closing this.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

hivesey picture hivesey  路  3Comments

Reidond picture Reidond  路  3Comments

rsnider19 picture rsnider19  路  3Comments

ricktotec picture ricktotec  路  3Comments

MahdiPishguy picture MahdiPishguy  路  3Comments