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

0.3.7 迁移 flutter 2.0 null safety #762

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

leftcoding
Copy link

迁移 null safety

@CLAassistant
Copy link

CLAassistant commented Jul 7, 2021

CLA assistant check
All committers have signed the CLA.

@gx2015
Copy link

gx2015 commented Aug 18, 2021

迁移 null safety

您好! 使用您的分支,发现一个问题:adapter_extensions 文件:SimpleFlowAdapter.dynamic 和 SimpleFlowAdapter.listLike 中 @deprecated key 没有处理成可选 require 关键字未去掉

@leftcoding
Copy link
Author

迁移 null safety

您好! 使用您的分支,发现一个问题:adapter_extensions 文件:SimpleFlowAdapter.dynamic 和 SimpleFlowAdapter.listLike 中 @deprecated key 没有处理成可选 require 关键字未去掉

好的。

@emodeqidao
Copy link

迁移 null safety

到目前为止 稳定吗?

@leftcoding
Copy link
Author

迁移 null safety

到目前为止 稳定吗?

还行,我们公司用着,没啥问题

@danieldai
Copy link
Contributor

有个函数迁移后含义有点变化:

迁移后所有的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;
  };

@shirne
Copy link

shirne commented May 28, 2022

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;
    }

有好几处,对照修改就可以了

@leftcoding
Copy link
Author

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;
    }

有好几处,对照修改就可以了

嗯,有几个没改好。

@bauer-bao
Copy link

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会有这样的问题,该如何解决?

@iMinger
Copy link

iMinger commented Dec 15, 2023

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 老哥,遇到了跟你一样的问题,请问你有没有解决这个问题?

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

Successfully merging this pull request may close these issues.

9 participants