cloudflare / cloudflare/realtimekit-ui
[Flutter/Android] Cannot init a second meeting in the same process — init() after leave/release emits no lifecycle events
- Dominant language
- TypeScript
- Stars
- 64
- Forks
- 22
- Avg merge
- 1d 18h
- Merged PRs (30d)
- 5
Description
### Environment
- realtimekit_ui 0.4.0, realtimekit_core 0.1.6 (mobile-core-bridge 1.7.1)
- Flutter 3.x / Dart 3.11, Android 15 (API 35), physical device
- baseDomain: realtime.cloudflare.com
### Summary
After a successful init → join → leave cycle, initializing a SECOND meeting in the same app process no longer works. RealtimekitClient.init() completes with no error, but no RtkMeetingRoomEventListener callbacks fire — onMeetingInitStarted and onMeetingInitCompleted never arrive — so the app is stuck on a loading state. Reproduces whether the first meeting is ended with meeting.leaveRoom() OR meeting.release(). The camera briefly turns ACTIVE during the second init, but no init lifecycle events are delivered. Only killing the app process (swipe from recents) restores the ability to join. A Flutter hot restart (new Dart isolate, SAME OS process) does NOT fix it, indicating process-level native state that survives release() and isolate restart.
### Steps to reproduce
1. init(meetingInfo) → onMeetingInitCompleted → joinRoom() → onMeetingRoomJoinCompleted (works)
2. leaveRoom() (or release())
3. init(meetingInfo) again with a fresh authToken → call returns without error, but NO onMeetingInitStarted / onMeetingInitCompleted fire
### Result: stuck; no way to proceed to setup/join.
### Expected
A second init/join within the same process should emit lifecycle events and work, or there should be a documented reset/reinit API.
##### Investigation notes
- In realtimekit_core_android 0.1.6, FlutterCorePlugin builds RtkClient(RealtimeKitMeetingBuilder.build(activity)) and FlutterCoreMethodChannelHandler once (guarded by `== null`); they are only nulled in onPreEngineRestart. No method-channel "reset/reinit" exists.
- release() → releaseMeeting onReleaseSuccess=true, yet a subsequent init() still emits no room events.
### Questions
- Is sequential multi-meeting-per-process supported? If yes, what is the correct teardown + reinit sequence?
Contributor guide
Research direction
Reproduce the sequence with realtimekit_core_android 0.1.6, then inspect FlutterCorePlugin and FlutterCoreMethodChannelHandler, especially their one-time construction and release handling. Trace the native lifecycle after leaveRoom() and release(), including a Flutter hot restart. Done means a second init in the same process emits the expected lifecycle events, or the supported teardown and reinitialization behavior is documented.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- android, flutter
- Domain
- mobile
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100