xuelongqy / flutter_easy_refresh

A flutter widget that provides pull-down refresh and pull-up load.
https://xuelongqy.github.io/flutter_easy_refresh/
MIT License
3.85k stars 630 forks source link

refresh on !mounted #698

Closed foxsofter closed 1 year ago

foxsofter commented 1 year ago

Null check operator used on a null value. Error thrown null. at State.setState(framework.dart:1134) at _EasyRefreshSliverRefreshControlState.finishRefresh(refresh_indicator.dart:659) at EasyRefreshController.finishRefresh(refresher.dart:649)

xuelongqy commented 1 year ago

Before calling finishRefresh, do you check mounted? If it is clear that it is a problem with EasyRefresh, can you provide a reproducible case?

foxsofter commented 1 year ago

问题是,到处都在用,改的成本太大了。。。我是觉得库内部加个判断,简单些。。。

xuelongqy commented 1 year ago

我觉得这个错误也许是好事,可以暴露一些错误的状态信息。EasyRefresh暂时不会进行处理。我敢打赌如果处理后,绝对会有新的issue提出,为什么调用finishRefresh后没有反应。所以不利于开发者去排查问题,而且你永远不会猜到他们是怎么在使用框架。。

foxsofter commented 1 year ago

不管在哪里处理,其实最后都是一样的问题,EasyRefresh 本身作为 widget 如果自己都被释放了还允许调用也并不是很好的容错方式

xuelongqy commented 1 year ago

这跟容错无关,也并非是只有释放会存在这个问题。开发者的错误调用不能由框架买单吧,这本身就是不合理的处理方式。如果说是容错的话,为何Flutter不在根源上去避免这个错误呢?