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

Question: Is there a way to apply middleware after action #114

Closed
Nanofortress opened this issue Mar 14, 2019 · 2 comments
Closed

Question: Is there a way to apply middleware after action #114

Nanofortress opened this issue Mar 14, 2019 · 2 comments

Comments

@Nanofortress
Copy link

I was wondering if it is possible to apply a middleware after an action.

@brianegan
Copy link
Owner

Do you mean after the action reaches the reducer? If so, you can definitely do this!

void myMiddleware(Store<AppState> store, dynamic action, NextDispatcher next) {
  // call next immediately. This will forward the action to the reducer
  next(action);
  
  print(store.state); // Prints the new app state after the reducer has run
}

Does that help?

@Nanofortress
Copy link
Author

Thanks! This was what I was looking for.

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