Asynchronous routing #2371
              
                Unanswered
              
          
                  
                    
                      Ambassador-of-programming
                    
                  
                
                  asked this question in
                Q&A
              
            Replies: 1 comment
-
| Read more here. I made some modifications to your code. I actually just added  class Router:
    def __init__(self):
        self.routes = {
            "/statistics": statistic(),
        }
        self.body = ft.Container(content=self.routes["/statistics"])
    async def route_change(self, route):
        routes = {
            "/statistics": statistic(),
        }
        body = ft.Container(content=self.routes["/statistics"])
        self.body.content = self.routes[route.route]
        await self.body.update_async()
def main(page: ft.Page):
    myRouter = Router()
    page.on_route_change = myRouter.route_change
    page.add_async(myRouter.body)
    page.go_async("/statistics")
ft.app_async(target=main) | 
Beta Was this translation helpful? Give feedback.
                  
                    0 replies
                  
                
            
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment
  
        
    
Uh oh!
There was an error while loading. Please reload this page.
-
Fail to implement asynchronous routing in Flet. How can it be done?
I have synchronous routing that works and I want to rewrite it to asynchronous routing
main.py:
route.py:
st.py:
Beta Was this translation helpful? Give feedback.
All reactions