【发布时间】:2019-07-07 05:02:42
【问题描述】:
我在List 收到来自 linter 的消息:
指定类型注释
但是我不明白它想要什么类型。对于Map,我可以这样:
<String, String>{}
Map 位于末尾,我在开头指定类型,但找不到适合我的减速器和史诗的正确类型。
我当前的代码:
final profileReducer = combineReducers<Profile>([
TypedReducer<Profile, UpdateProfileBalanceAction>(_updateProfileBalance),
TypedReducer<Profile, FetchProfileResultAction>(_setProfile),
]);
和:
final epics = combineEpics<AppState>([
TypedEpic<AppState, FetchProfileAction>(profileEpic),
]);
【问题讨论】:
-
Dart 不支持联合类型,所以这里不能有 real 类型。需要动态
-
:(这意味着我无法修复该警告?(我尝试使用
dynamic,但没有成功) -
这意味着你不能有防错类型。但是您可以修复警告。我会发布它作为答案