-
QuestionIn the documentation it is mentioned that "Native Python packages for Android and iOS" require to use
Code sampleNo response Error messageNo response ------------------------------------------------------
|
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 3 replies
-
|
Beta Was this translation helpful? Give feedback.
-
|
Beta Was this translation helpful? Give feedback.
-
I gave accessing a FastAPI server from Flet another try and it now worked like a charm. With the following FastAPI server: from fastapi import FastAPI
app = FastAPI()
@app.get("/")
async def read_root():
return {"Hello": "World"} I was able to access the server with the following script: import requests
import flet as ft
async def main(page: ft.Page):
page.title = "Flet counter example"
page.vertical_alignment = ft.MainAxisAlignment.CENTER
my_text = ft.Text(value="START")
async def on_click(e):
r = requests.get("http://<ip>:<port>/")
my_text.value = r.content.decode("utf-8")
await page.update_async()
await page.add_async(
ft.Row(
[
ft.ElevatedButton(text="Click", on_click=on_click),
my_text,
],
alignment=ft.MainAxisAlignment.CENTER,
)
)
ft.app(target=main) I am unsure, what went wrong before. But I am very happy I can now build true android apps using python. |
Beta Was this translation helpful? Give feedback.
I gave accessing a FastAPI server from Flet another try and it now worked like a charm. With the following FastAPI server:
I was able to access the server with the following script: