[Question]RuntimeWarning: coroutine #2926
-
QuestionHello. The code I've attached is working fine. Everything is displaying correctly. However, I'm encountering an error in the console. What could be the problem? Code sampleimport asyncio
import flet as ft
class BotSheet(ft.BottomSheet):
def __init__(self):
super().__init__()
self.is_scroll_controlled=True
def did_mount(self):
self.open = True
self.page.run_task(self.build)
def will_unmount(self):
self.open = False
async def build(self):
self.content = ft.Container(height=300, bgcolor='red')
self.update()
await asyncio.sleep(1)
def main(page: ft.Page):
page.add(
ft.OutlinedButton('Click',
on_click=lambda e: page.show_bottom_sheet(BotSheet())
)
)
ft.app(main) Error messageRuntimeWarning: coroutine 'BotSheet.build' was never awaited innerCmds = ctrl._build_add_commands( RuntimeWarning: Enable tracemalloc to get the object allocation traceback ------------------------------------------------------
|
Beta Was this translation helpful? Give feedback.
Answered by
ndonkoHenri
Mar 22, 2024
Replies: 2 comments 2 replies
-
The Read this: https://python.plainenglish.io/whats-new-in-flet-0-21-0-ca482ab4520b |
Beta Was this translation helpful? Give feedback.
2 replies
Answer selected by
Klu1d
-
what did_mount also does not async |
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
The
build
method shouldn't be made async.Read this: https://python.plainenglish.io/whats-new-in-flet-0-21-0-ca482ab4520b