Bloc: Listener Not Calling for Pull to Refresh if the data is not changed.

Created on 26 Jun 2020  路  1Comment  路  Source: felangel/bloc

Hi there,

I tried the example of pull-to-refresh from weather example and implemented it to pull the list of data from the server with a fixed set of data. Implementation was straight forward and also implemented the _refreshCompleter login in BlocConsumer.

While trying to perform Pull to refresh operation, Log shows that request was made successfully but since the data was the same as before, BlocComsumer was not called hence the refresh indicator kept on show. Later I tried the API call for Refresh with different page numbers providing new sets of data, the example worked and the refresh indicator was gone as aspected.

Is there any workaround or a solution, cause refresh Indicator is stuck if the data does not change.

example question

Most helpful comment

Hi @spike04 馃憢
Thanks for opening an issue! Blocs ignore duplicate states internally so if you wish to have the state always be emitted you can either avoid extending Equatable or add a property like DateTime lastUpdate to your weather model.

Hope that helps 馃憤

>All comments

Hi @spike04 馃憢
Thanks for opening an issue! Blocs ignore duplicate states internally so if you wish to have the state always be emitted you can either avoid extending Equatable or add a property like DateTime lastUpdate to your weather model.

Hope that helps 馃憤

Was this page helpful?
0 / 5 - 0 ratings