Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refreshController.dispose 报错! #726

Closed
ehangwork opened this issue May 24, 2023 · 5 comments
Closed

refreshController.dispose 报错! #726

ehangwork opened this issue May 24, 2023 · 5 comments

Comments

@ehangwork
Copy link

[VERBOSE-2:dart_vm_initializer.cc(41)] Unhandled Exception: A HeaderNotifier was used after being disposed.
Once you have called dispose() on a HeaderNotifier, it can no longer be used.
#0 ChangeNotifier.debugAssertNotDisposed. (package:flutter/src/foundation/change_notifier.dart:157:9)
#1 ChangeNotifier.debugAssertNotDisposed (package:flutter/src/foundation/change_notifier.dart:164:6)
#2 ChangeNotifier.notifyListeners (package:flutter/src/foundation/change_notifier.dart:360:27)
#3 IndicatorNotifier._updateBySimulation. (package:easy_refresh/src/notifier/indicator_notifier.dart:489:9)
#4 new Future. (dart:async/future.dart:253:37)
#5 Timer._createTimer. (dart:async-patch/timer_patch.dart:18:15)
#6 _Timer._runTimers (dart:isolate-patch/timer_impl.dart:398:19)
#7 _Timer._handleMessage (dart:isolate-patch/timer_impl.dart:429:5)
#8 _RawReceivePort._handleMessage (dart:isolate-patch/iso<…>

@xuelongqy
Copy link
Owner

麻烦提供一下可运行的复现案例,我排查一下问题~

@taozhang1029
Copy link

我也遇到了这个问题,B页面使用了EasyRefresh,从A页面进入B页面,不滑动直接返回会报这个错,向下滑后再返回则没有问题

@mao437303994
Copy link

麻烦提供一下可运行的复现案例,我排查一下问题~

微信图片_20230630170435
这个地方不能异步触发,因为触发之前他可能已经被销毁了,会报错

@moaumn
Copy link

moaumn commented Oct 26, 2023

这个错误触发环境比较复杂,我测试了很多次,当EasyRefresh的子组件中有TabBar且TabBar设置为允许滚动且超过屏幕宽度的同时,在页面中再加入PageView组件,同时页面高度要超过屏幕高度,从另一个页面进入该页面,不要触发下拉加载,直接返回就会有上面的那个错误。如果下拉加载一次以后,再返回就不会有这个错误。

EasyRefresh(
        clipBehavior: Clip.none,
        controller: _controller,
        header: ClassicHeader(),
        onRefresh: () async {
          await Future.delayed(Duration(seconds: 2));
        },
        child: CustomScrollView(
          slivers: [
            SliverToBoxAdapter(
              child: Column(
                children: [
                  TabBar(
                    controller: tabController,
                    isScrollable: true,
                    tabs: [
                      Tab(text: 'Tab 1111111111111'),
                      Tab(text: 'Tab 2222222222222'),
                      Tab(text: 'Tab 3333333333333'),
                      Tab(text: 'Tab 3333333333333'),
                      Tab(text: 'Tab 3333333333333'),
                      Tab(text: 'Tab 3333333333333'),
                    ],
                  ),
                  SizedBox(
                    height: 1000,
                    child: PageView(
                      controller: pageController,
                      children: [
                        Container(),
                        Container(),
                        Container(),
                      ],
                    ),
                  ),
                ],
              ),
            ),
          ],
        ),
      ),

@xuelongqy
Copy link
Owner

3.3.4尝试已修复,如还有问题,请重新开启此issue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants