How to get FletService.init() to fire on Android for a custom Service Extension? (Flet 0.84) #6427
Unanswered
youngnckk12-design
asked this question in
Q&A
Replies: 0 comments
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.
-
Question
Summary
Custom Flet Service Extension builds and installs correctly, but the Dart
FletService.init()method is never called at runtime. NodebugPrintoutput reaches logcat despiteflet buildconfirming the extension was found and registered.Environment
flet build aabvia GitHub Actionsin_app_purchase: ^3.2.0What works ✅
pip install ./flet-billingsucceeds for all 4 Android ABIsFound Flutter extension at .../build/flutter-packages/flet_billing
Registered Flutter user extensions ✅
from flet_billing import FletBillingsucceedsFletBilling(product_id="...", ...)returns without errorpage.services.append(billing)executes without errorpage.update()is called immediately after appendserious_python: CPython loadedandPy_Initialize()complete successfully in logcatWhat doesn't work ❌
BillingService.init()(Dart) is never calleddebugPrint("[flet-billing] init() called")as the very first line ofinit()— zero output in logcat across three different buildsbilling.buy()from Python →self.invoke_method("buy")never reaches Dart's_invokeMethodlisteneradb logcat flutter:V *:W > out.txtExtension structure
Python side (
src/flet_billing/flet_billing.py):Dart side —
extension.dart:Dart side —
billing_service.dart(abbreviated, matcheshaptic_feedback.dartreference pattern):Python usage in app's main.py:
pyproject.toml (extension)
pyproject.toml (app)
What I've tried
haptic_feedback.dartandflet-permission-handler— code now matches reference pattern (super.init(),super.dispose(),Future<dynamic>/dynamicsignature)page.services.append(billing)with and without subsequentpage.update()pip installoutput and build registration in CI logs — both cleanQuestion
In Flet 0.84, what triggers
FletService.init()to fire on a service added topage.services? Is there a registration step I'm missing betweenExtension.createService()being registered and the actual instantiation? Or is the issue likely in my@ft.control("flet_billing")Python decorator — should it be"FletBilling"(PascalCase matching the class name) instead?Full extension source available if helpful.
Thanks 🙏
Code sample
No response
Error message
No response
------------------------------------------------------
Beta Was this translation helpful? Give feedback.
All reactions