We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
_EasyRefreshState initState初始化数据时,Future中_callRefresh是延迟执行的,会存在_callRefresh还未执行时先执行了dispose()。 而_headerNotifier.dispose()会将_onCanProcess置为null,而IndicatorNotifier 中 bool get _canProcess => _onCanProcess!.call(); 强制不为null。最终执行_callRefresh报空指针异常
bool get _canProcess => _onCanProcess!.call();
// _EasyRefreshState代码 @override void initState() { super.initState(); // Refresh on start. if (widget.refreshOnStart && widget.onRefresh != null) { _isRefreshOnStart = true; Future(() { _ambiguate(WidgetsBinding.instance)!.addPostFrameCallback((timeStamp) { _callRefresh( overOffset: widget.callRefreshOverOffset, duration: null, ); }); }); } _initData(); widget.controller?._bind(this); } @override void dispose() { _headerNotifier.dispose(); _footerNotifier.dispose(); _userOffsetNotifier.dispose(); super.dispose(); } // _callRefresh最终执行的代码 Future callTask({ required double overOffset, Duration? duration, Curve curve = Curves.linear, ScrollController? scrollController, bool force = false, }) { if (!force) { // 就是!_canProcess空指针异常 if (modeLocked || noMoreLocked || secondaryLocked || !_canProcess) { return Future.value(); } } else { _offset = 0; _mode = IndicatorMode.inactive; _processing = false; } return animateToOffset( offset: actualTriggerOffset + overOffset, mode: IndicatorMode.ready, duration: duration, curve: curve, scrollController: scrollController, ); } // IndicatorNotifier代码 // 强制_onCanProcess不会为null bool get _canProcess => _onCanProcess!.call(); // 但是dispose里会置为null @override void dispose() { _onCanProcess = null; _clampingAnimationController?.dispose(); userOffsetNotifier.removeListener(_onUserOffset); _task = null; _modeChangeListeners.clear(); _indicator.listenable?._unbind(); _mounted = false; super.dispose(); }
The text was updated successfully, but these errors were encountered:
fix: IndicatorNotifier._onCanProcess. Null check operator used on a n…
c4024e6
…ull value (#782), (#774).
5112e41
3.3.2+4 已解决
Sorry, something went wrong.
No branches or pull requests
_EasyRefreshState initState初始化数据时,Future中_callRefresh是延迟执行的,会存在_callRefresh还未执行时先执行了dispose()。
而_headerNotifier.dispose()会将_onCanProcess置为null,而IndicatorNotifier 中
bool get _canProcess => _onCanProcess!.call();
强制不为null。最终执行_callRefresh报空指针异常
The text was updated successfully, but these errors were encountered: