Open leftcoding opened 3 years ago
迁移 null safety
您好! 使用您的分支,发现一个问题:adapter_extensions 文件:SimpleFlowAdapter.dynamic 和 SimpleFlowAdapter.listLike 中 @deprecated key 没有处理成可选 require 关键字未去掉
迁移 null safety
您好! 使用您的分支,发现一个问题:adapter_extensions 文件:SimpleFlowAdapter.dynamic 和 SimpleFlowAdapter.listLike 中 @deprecated key 没有处理成可选 require 关键字未去掉
好的。
迁移 null safety
到目前为止 稳定吗?
迁移 null safety
到目前为止 稳定吗?
还行,我们公司用着,没啥问题
有个函数迁移后含义有点变化:
迁移后所有的subReducer都是对原始的state进行处理,所以只有最后一个subreducer产生了效果
return (T state, Action action) {
T? _copy;
bool hasChanged = false;
for (SubReducer<T>? subReducer in notNullReducers) {
_copy = subReducer?.call(state, action, hasChanged);
hasChanged = hasChanged || _copy != state;
}
assert(_copy != null);
return _copy;
};
return (T state, Action action) {
T copy = state;
bool hasChanged = false;
for (SubReducer<T> subReducer in notNullReducers) {
copy = subReducer(copy, action, hasChanged);
hasChanged = hasChanged || copy != state;
}
assert(copy != null);
return copy;
};
notNullReducers
把notNullReducers过滤成非空项的List,这里含义就可以改回来
final List<SubReducer<T>?>? notNullReducers = subReducers
.where((SubReducer<T>? e) => e != null)
.toList(growable: false);
// 修改为
final List<SubReducer<T>>? notNullReducers = subReducers
.whereType<SubReducer<T>>().toList();
T _copy = state;
bool hasChanged = false;
for (SubReducer<T> subReducer in notNullReducers) {
_copy = subReducer.call(_copy, action, hasChanged);
hasChanged = hasChanged || _copy != state;
}
有好几处,对照修改就可以了
notNullReducers
把notNullReducers过滤成非空项的List,这里含义就可以改回来
final List<SubReducer<T>?>? notNullReducers = subReducers .where((SubReducer<T>? e) => e != null) .toList(growable: false); // 修改为 final List<SubReducer<T>>? notNullReducers = subReducers .whereType<SubReducer<T>>().toList();
T _copy = state; bool hasChanged = false; for (SubReducer<T> subReducer in notNullReducers) { _copy = subReducer.call(_copy, action, hasChanged); hasChanged = hasChanged || _copy != state; }
有好几处,对照修改就可以了
嗯,有几个没改好。
Flutter Exception type '() => Object' is not a subtype of type '() => DataPackageUnuseItemState' of 'getter'
#1 DynamicFlowAdapter.buildAdapter.<anonymous closure> (package:fish_redux/src/redux_adapter/dynamic_flow_adapter.dart:78:27)
#2 combineListAdapters.<anonymous closure> (package:fish_redux/src/redux_adapter/recycle_context.dart:106:35)
#3 SliverChildBuilderDelegate.build (package:flutter/src/widgets/sliver.dart:471:22)
#4 SliverMultiBoxAdaptorElement._build (package:flutter/src/widgets/sliver.dart:1236:28)
#5 SliverMultiBoxAdaptorElement.createChild.<anonymous closure> (package:flutter/src/widgets/sliver.dart:1250:55)
#6 BuildOwner.buildScope (package:flutter/src/widgets/framework.dart:2597:19)
#7 SliverMultiBoxAdaptorElement.createChild (package:flutter/src/widgets/sliver.dart:1242:12)
#8 RenderSliverMultiBoxAdaptor._createOrObtainChild.<anonymous closure> (package:flutter/src/rendering/sliver_multi_box_adaptor.dart:349:23)
#9 RenderObject.invokeLayoutCallback.<anonymous closure> (package:flutter/src/rendering/object.dart:2025:59)
#10 PipelineOwner._enableMutationsToDirtySubtrees (package:flutter/src/rendering/object.dart:918:15)
#11 RenderObject.invokeLayoutCallback (package:flutter/src/rendering/object.dart:2025:14)
#12 RenderSliverMultiBoxAdaptor._createOrObtainChild (package:flutter/src/rendering/sliver_multi_box_adaptor.dart:338:5)
#13 RenderSliverMultiBoxAdaptor.addInitialChild (package:flutter/src/rendering/sliver_multi_box_adaptor.dart:422:5)
#14 RenderSliverList.performLayout (package:flutter/src/rendering/sliver_list.dart:79:12)
#15 RenderObject.layout (package:flutter/src/rendering/object.dart:1915:7)
#16 RenderSliverEdgeInsetsPadding.performLayout (package:flutter/src/rendering/sliver_padding.dart:137:12)
#17 RenderSliverPadding.performLayout (package:flutter/src/rendering/sliver_padding.dart:371:11)
#18 RenderObject.layout (package:flutter/src/rendering/object.dart:1915:7)
#19 RenderViewportBase.layoutChildSequence (package:flutter/src/rendering/viewport.dart:510:13)
#20 RenderViewport._attemptLayout (package:flutter/src/rendering/viewport.dart:1580:12)
#21 RenderViewport.performLayout (package:flutter/src/rendering/viewport.dart:1489:20)
#22 RenderObject.layout (package:flutter/src/rendering/object.dart:1915:7)
#23 RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:116:14)
#24 RenderObject.layout (package:flutter/src/rendering/object.dart:1915:7)
#25 RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:116:14)
#26 RenderObject.layout (package:flutter/src/rendering/object.dart:1915:7)
#27 RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:116:14)
#28 RenderObject.layout (package:flutter/src/rendering/object.dart:1915:7)
#29 RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:116:14)
#30 RenderObject.layout (package:flutter/src/rendering/object.dart:1915:7)
#31 RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:116:14)
#32 RenderObject.layout (package:flutter/src/rendering/object.dart:1915:7)
#33 RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:116:14)
#34 RenderObject.layout (package:flutter/src/rendering/object.dart:1915:7)
#35 RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:116:14)
#36 RenderObject.layout (package:flutter/src/rendering/object.dart:1915:7)
#37 RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:116:14)
#38 RenderCustomPaint.performLayout (package:flutter/src/rendering/custom_paint.dart:545:11)
#39 RenderObject.layout (package:flutter/src/rendering/object.dart:1915:7)
#40 RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:116:14)
adapter会有这样的问题,该如何解决?
Flutter Exception type '() => Object' is not a subtype of type '() => DataPackageUnuseItemState' of 'getter' #0 Component.buildComponent (package:fish_redux/src/redux_component/component.dart) #1 DynamicFlowAdapter.buildAdapter. (package:fish_redux/src/redux_adapter/dynamic_flow_adapter.dart:78:27) #2 combineListAdapters. (package:fish_redux/src/redux_adapter/recycle_context.dart:106:35) #3 SliverChildBuilderDelegate.build (package:flutter/src/widgets/sliver.dart:471:22) #4 SliverMultiBoxAdaptorElement._build (package:flutter/src/widgets/sliver.dart:1236:28) #5 SliverMultiBoxAdaptorElement.createChild. (package:flutter/src/widgets/sliver.dart:1250:55) #6 BuildOwner.buildScope (package:flutter/src/widgets/framework.dart:2597:19) #7 SliverMultiBoxAdaptorElement.createChild (package:flutter/src/widgets/sliver.dart:1242:12) #8 RenderSliverMultiBoxAdaptor._createOrObtainChild. (package:flutter/src/rendering/sliver_multi_box_adaptor.dart:349:23) #9 RenderObject.invokeLayoutCallback. (package:flutter/src/rendering/object.dart:2025:59) #10 PipelineOwner._enableMutationsToDirtySubtrees (package:flutter/src/rendering/object.dart:918:15) #11 RenderObject.invokeLayoutCallback (package:flutter/src/rendering/object.dart:2025:14) #12 RenderSliverMultiBoxAdaptor._createOrObtainChild (package:flutter/src/rendering/sliver_multi_box_adaptor.dart:338:5) #13 RenderSliverMultiBoxAdaptor.addInitialChild (package:flutter/src/rendering/sliver_multi_box_adaptor.dart:422:5) #14 RenderSliverList.performLayout (package:flutter/src/rendering/sliver_list.dart:79:12) #15 RenderObject.layout (package:flutter/src/rendering/object.dart:1915:7) #16 RenderSliverEdgeInsetsPadding.performLayout (package:flutter/src/rendering/sliver_padding.dart:137:12) #17 RenderSliverPadding.performLayout (package:flutter/src/rendering/sliver_padding.dart:371:11) #18 RenderObject.layout (package:flutter/src/rendering/object.dart:1915:7) #19 RenderViewportBase.layoutChildSequence (package:flutter/src/rendering/viewport.dart:510:13) #20 RenderViewport._attemptLayout (package:flutter/src/rendering/viewport.dart:1580:12) #21 RenderViewport.performLayout (package:flutter/src/rendering/viewport.dart:1489:20) #22 RenderObject.layout (package:flutter/src/rendering/object.dart:1915:7) #23 RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:116:14) #24 RenderObject.layout (package:flutter/src/rendering/object.dart:1915:7) #25 RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:116:14) #26 RenderObject.layout (package:flutter/src/rendering/object.dart:1915:7) #27 RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:116:14) #28 RenderObject.layout (package:flutter/src/rendering/object.dart:1915:7) #29 RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:116:14) #30 RenderObject.layout (package:flutter/src/rendering/object.dart:1915:7) #31 RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:116:14) #32 RenderObject.layout (package:flutter/src/rendering/object.dart:1915:7) #33 RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:116:14) #34 RenderObject.layout (package:flutter/src/rendering/object.dart:1915:7) #35 RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:116:14) #36 RenderObject.layout (package:flutter/src/rendering/object.dart:1915:7) #37 RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:116:14) #38 RenderCustomPaint.performLayout (package:flutter/src/rendering/custom_paint.dart:545:11) #39 RenderObject.layout (package:flutter/src/rendering/object.dart:1915:7) #40 RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:116:14)
adapter会有这样的问题,该如何解决?
hi 老哥,遇到了跟你一样的问题,请问你有没有解决这个问题?
迁移 null safety