---
title: "Comment by Ali Ersöz on \"Flutter MVVM and Clean Architecture - Part 1: Setup\" | Hashnode"
description: "hey cassius, this is a great post. really appreciate it. i am pretty new to flutter and have one question. how would you navigate to another screen after a post"
url: "https://hashnode.com/posts/flutter-mvvm-and-clean-architecture-part-1-setup/618f936d83e4212d6e57844c/comment/61a44d162be89f3d0ab9f14f"
---

[Discussion](https://hashnode.com/posts/flutter-mvvm-and-clean-architecture-part-1-setup/618f936d83e4212d6e57844c)

Comment [Flutter MVVM and Clean Architecture - Part 1: Setup](https://hashnode.com/posts/flutter-mvvm-and-clean-architecture-part-1-setup/618f936d83e4212d6e57844c)

[Ali Ersöz](https://hashnode.com/@getinloop)

[Nov 29, 2021](https://hashnode.com/posts/flutter-mvvm-and-clean-architecture-part-1-setup/618f936d83e4212d6e57844c/comment/61a44d162be89f3d0ab9f14f)

hey cassius, this is a great post. really appreciate it.

i am pretty new to flutter and have one question. how would you navigate to another screen after a post api call here? say the view state is updated after a login and now i can navigate to home screen. since i expect that to be communicated via state update. the only place appear to me to do this is just above where you return the `Scaffold` but that doesn't feel right, since it would be updating the view.

[Cassius Pacheco](https://hashnode.com/@cassiuspacheco)

[Nov 29, 2021](https://hashnode.com/posts/flutter-mvvm-and-clean-architecture-part-1-setup/618f936d83e4212d6e57844c/comment/61a44d162be89f3d0ab9f14f#reply-61a497aa9ac0d611876b1890)

Hello, thanks for the feedback!

About routing, you really want to keep the logic about where and how you're navigating to in the view model, so you can unit test it as well as have complex routing systems depending on user interactions, like you mentioned, after an API call, for example.

Now, you don't want to access widgets, context, Navigators, etc in the view model, you only want the pure logic in there, such as the routing logic.

If you want a spoiler of the next post showing how I do it, have a look at the part 2 of the series code [github.com/CassiusPacheco/flutter\_mvvm/commit/fbd…](https://github.com/CassiusPacheco/flutter_mvvm/commit/fbd7237ed1f08993becf16ff7a80ec6aacee044f)

The post explaining it will be coming up soon. Hope that helps!

[Cassius Pacheco](https://hashnode.com/@cassiuspacheco)

[Nov 29, 2021](https://hashnode.com/posts/flutter-mvvm-and-clean-architecture-part-1-setup/618f936d83e4212d6e57844c/comment/61a44d162be89f3d0ab9f14f#reply-61a4af649ac0d611876b1b68)

Good news Ali, I've just posted the part 2 of the series that explains routing [cassiuspacheco.com/flutter-mvvm-and-clean-archite…](https://cassiuspacheco.com/flutter-mvvm-and-clean-architecture-part-2-testable-routing-ckwkjnkph0dmngns1cf8e7d5n)

[Ali Ersöz](https://hashnode.com/@getinloop)

[Nov 29, 2021](https://hashnode.com/posts/flutter-mvvm-and-clean-architecture-part-1-setup/618f936d83e4212d6e57844c/comment/61a44d162be89f3d0ab9f14f#reply-61a4ce8e2be89f3d0ab9fc7c)

[Cassius Pacheco](https://hashnode.com/@cassiuspacheco)

hi cassius, this is great and thank you very much for the quick response. it is funny that right after sending this message I also came up with a similar solution. although in my case I opted in to having each view model to define its own possible routes, so that it doesn’t have the full power of accessing anywhere in the app. so it emits events from the view model (such as emitting `second` event to the `navigationEvents` publish subject) which gets observed in the view state and then view state does the navigation.

i liked the fact that you abstracted the observation part and put that to the base class. also liked the `AppRouteAction` enum you defined to even further abstract the routing.

great job for one of the most complete and clean flutter architecture post.
