ARTICLE AD BOX
I’m currently integrating the Privy SDK into a Flutter project and I've run into an architectural challenge regarding the SDK's "Single Instance" requirement.
The problem is that Privy must maintain a single instance throughout the app's lifetime. Since the SDK is initialized via the Flutter Plugin, a Privy instance already exists within the FlutterEngine. However, I need to access specific MFA methods (SMS, TOTP) in my MainActivity.kt using MethodChannels.
If I call Privy.init() again in MainActivity, it triggers a DataStore conflict (IllegalStateException). This happens because two separate instances are trying to access the same .preferences_pb file simultaneously.
I need a way to "grab" or reference the same instance that the Flutter Plugin is using so I can call MFA methods in native Kotlin without re-initializing the SDK.
Has anyone dealt with sharing a singleton native instance across the Flutter/Native boundary? Is Pigeon a viable solution for this, or should I be looking at a different dependency injection pattern in Android?
