alibaba/fish-redux

flutter 又新增了 `Page` 类,跟 fish 冲突了。

Closed this issue · 10 comments

flutter 又新增了 Page 类,跟 fish 冲突了。未来需要 hide 一下。

@dddrop 可否通过hide的方式避免,跟action一样?

@dddrop 我试了一下,好像不行,fish-redux给的例子中,如果hide 了 Page, 会有其他错误。
The argument type 'Null Function(String, Page<Object, dynamic>)' can't be assigned to the parameter type 'void Function(String, dynamic)'.

可以。fish 的 page_routes.dart 引用了flutter的widget。在这个文件里面:

import 'package:flutter/widgets.dart' hide Page;

就OK了。

所有,是修改 fish 的源码,可以提交一个 PR 。

想问下官方 这个项目是不是不维护了?几个月不更新了
Action和Page命名冲突的问题靠hide不能解决根本问题吧?

@zjuwjf 大佬来出来聊聊

Compiler message:
../../flutter/.pub-cache/hosted/pub.flutter-io.cn/fish_redux-0.3.1/lib/src/redux_routes/page_routes.dart:13:21: Error: Expected 0 type arguments.
final Map<String, Page<Object, dynamic>> pages;
^
../../flutter/.pub-cache/hosted/pub.flutter-io.cn/fish_redux-0.3.1/lib/src/redux_routes/page_routes.dart:19:27: Error: Expected 0 type arguments.
void Function(String, Page<Object, dynamic>) visitor,
^
../../flutter/.pub-cache/hosted/pub.flutter-io.cn/fish_redux-0.3.1/lib/src/redux_routes/page_routes.dart:3:1: Error: 'Page' is imported from both 'package:flutter/src/widgets/navigator.dart' and
'package:fish_redux/src/redux_component/page.dart'.
import '../redux_component/redux_component.dart';
^^^^
lib/appRoute.dart:12:45: Error: The argument type 'Map<String, Page<Object, dynamic>>' can't be assigned to the parameter type 'Map<String, invalid-type>'.

  • 'Map' is from 'dart:core'.
  • 'Page' is from 'package:fish_redux/src/redux_component/page.dart' ('../../flutter/.pub-cache/hosted/pub.flutter-io.cn/fish_redux-0.3.1/lib/src/redux_component/page.dart').
  • 'Object' is from 'dart:core'.
    pages: <String, Page<Object, dynamic>>{
    ^

page_routes 做import 'package:flutter/widgets.dart' hide Page; 这个处理了还是不行

我的解决方案(注意: 此方案治标不治本)

  • clone fish_redux(默认: master分支)
git clone https://github.com/alibaba/fish-redux.git
  • 打开fish-redux
  • fish-redux/lib/src目录下的
    import 'package:flutter/widgets.dart';替换成import 'package:flutter/widgets.dart' hide Page;,
    以及把
    import 'package:flutter/widgets.dart' hide Action;替换成import 'package:flutter/widgets.dart' hide Action, Page;
  • fish-redux/lib/src拷贝到${YourFlutterPath}/.pub-cache/hosted/pub.flutter-io.cn/fish_redux-0.3.1/lib, 替换src文件夹
  • 你代码中可能包含flutter提供Page的库加上hide Page.例如: import 'package:flutter/widgets.dart';替换成import 'package:flutter/widgets.dart' hide Page;

感谢反馈,近期会处理。 后续还是需要基础到flutter/test里去。

0.3.2 已经发布