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

学习疑问 #402

Closed
kadoyatsukasa opened this issue May 21, 2019 · 7 comments
Closed

学习疑问 #402

kadoyatsukasa opened this issue May 21, 2019 · 7 comments

Comments

@kadoyatsukasa
Copy link

gsy_tabbar_widget里面有个地方不太明白

_onPageChanged?.call(index);

这里这个call()方法的定义怎么找不到?no definition found for 'call'

@CarGuo
Copy link
Owner

CarGuo commented May 21, 2019

Dart 为了能够让类可以像像函数一样调用,默认都可以实现 call() 方法,而 typedef 定义的方法也是具备 call() ;

比如我修改了

class TarWidgetControl {
  List<Widget> footerButton = [];

  call(int i, double e) => "$i xxxx $e";
}

就可以通过以下执行

print(widget.tarWidgetControl(11, 11.0));

然后我定义了

typedef void ValueII(int i);

  ValueII tt = (int i){
    print("zzz $i");
  };

就可以通过直接执行和判空执行处理

 tt(666);
 tt?.call(777);

@kadoyatsukasa
Copy link
Author

也就是说tt?.call(777)等价于tt(777)_onPageChanged?.call(index);等价于_onPageChanged(index)的意思???

@CarGuo
Copy link
Owner

CarGuo commented May 21, 2019

是的,只是增加了 ? 进行判空 。 比如 tt 为 null 的时候,不会执行

@kadoyatsukasa
Copy link
Author

你的middleware是你自己写的,还是从哪个第三方库下载过来的?都是英文,有点难啃

@CarGuo
Copy link
Owner

CarGuo commented May 21, 2019

https://github.com/brianegan/dart_redux_epics 之前不支持dart2,所以源码引入

@kadoyatsukasa
Copy link
Author

大佬,如何对一个完整项目进行整体规划?我这第一次自己进行项目,没有一个整体规划,写下来之后,整个就是很乱

@CarGuo
Copy link
Owner

CarGuo commented May 22, 2019

em·····这个,要不你找本软件工程看看

@CarGuo CarGuo closed this as completed May 22, 2019
@jayVRIY jayVRIY mentioned this issue Dec 8, 2022
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

2 participants