reown-com/reown_flutter

_appKitModal@44472063' has not been initialized

Closed this issue · 3 comments

LateInitializationError: Field '_appKitModal@44472063' has not been initialized.
E/flutter ( 5090): [ERROR:flutter/runtime/dart_vm_initializer.cc(41)] Unhandled Exception: Invalid argument(s): Type IMagicService is already registered inside GetIt.

Hello @ChekoutMkt! I already explained this in both of your previous issues.

When LateInitializationError: Field '_appKitModal@44472063' has not been initialized. happens it's because you are somehow using _appKitModal instance before it is instantiated

When Unhandled Exception: Invalid argument(s): Type IMagicService is already registered inside GetIt. happens it means you re initialization (calling init() on _appKitModal) more than once.

Please check your code, this is an error on your implementation.

Furthermore, on AppKitModalConnectButton you have this: _appKitModal.status.isInitialized & _isAppKitModalInitialized (with just one ampersand). Please be aware that & and && are completely different things on Dart so your condition will be always false.

That being said, I will push shortly a new beta with registerSingletonIfAbsent instead of registerSingleton

Hello @ChekoutMkt, I just pushed a new 1.1.0-beta02 with registerSingletonIfAbsent but please be mindful of your code.

Let me know

thank you