-
Notifications
You must be signed in to change notification settings - Fork 843
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
读取本地缓存的账号密码信息赋值给TextEditingController会报错 #268
Comments
Invalid argument(s): Reducers may not dispatch actions。无效参数。你排查一下。 |
原因: 使得,在_account reducer进行过程内部,再次触发nameEditingController内部监听的reducer,导致异常。 真确的做法: LoginState _account(LoginState state, Action action) {
final Map<String, dynamic> update = action.payload ?? <String, dynamic>{};
final LoginState newState = state.clone();
newState.nameEditingController = update['nameEditingController'] ;
newState.passEditingController= update['passEditingController'];
newState.name = update['name'] ?? state.name;
newState.pass = update['pass'] ?? state.pass;
return newState;
} 其中update['nameEditingController']是新创建的controller 或者在nameEditingController内部监听中延迟一帧发送action。 |
context.dispatch(LoginActionCreator.accountAction(await SharedPreferenceUtil.getString('name'),await SharedPreferenceUtil.getString('pass'))); |
The text was updated successfully, but these errors were encountered: