kiwi icon indicating copy to clipboard operation
kiwi copied to clipboard

Kiwi injection not working in background/app killed state.

Open saravananmnm opened this issue 2 years ago • 3 comments

[√] Flutter (Channel stable, 2.5.0, on Microsoft Windows [Version 10.0.17763.1577], locale en-IN) • Flutter version 2.5.0 at C:\Flutter_SDK\flutter • Upstream repository https://github.com/flutter/flutter.git • Framework revision 4cc385b4b8 (7 months ago), 2021-09-07 23:01:49 -0700 • Engine revision f0826da7ef • Dart version 2.14.0

[√] Android toolchain - develop for Android devices (Android SDK version 30.0.3) • Android SDK at D:\Sdk • Platform android-31, build-tools 30.0.3 • ANDROID_HOME = D:\Sdk • Java binary at: C:\Program Files\Android\Android Studio\jre\bin\java • Java version OpenJDK Runtime Environment (build 11.0.10+0-b96-7249189) • All Android licenses accepted.

[√] Chrome - develop for the web • Chrome at C:\Program Files\Google\Chrome\Application\chrome.exe

[√] Android Studio (version 2020.3) • Android Studio at C:\Program Files\Android\Android Studio • Flutter plugin can be installed from: https://plugins.jetbrains.com/plugin/9212-flutter • Dart plugin can be installed from: https://plugins.jetbrains.com/plugin/6351-dart • Java version OpenJDK Runtime Environment (build 11.0.10+0-b96-7249189)

[√] IntelliJ IDEA Community Edition (version 2021.3) • IntelliJ at C:\Program Files\JetBrains\IntelliJ IDEA Community Edition 2021.3.3 • Flutter plugin can be installed from: https://plugins.jetbrains.com/plugin/9212-flutter • Dart plugin can be installed from: https://plugins.jetbrains.com/plugin/6351-dart

[√] Connected device (3 available) • Android SDK built for x86 (mobile) • emulator-5554 • android-x86 • Android 11 (API 30) (emulator) • Chrome (web) • chrome • web-javascript • Google Chrome 100.0.4896.127 • Edge (web) • edge • web-javascript • Microsoft Edge 100.0.1185.44

saravananmnm avatar Apr 20 '22 09:04 saravananmnm

Can you give a small working example. Make sure you initialize your dependency injection again in your background isolate. if you are using isolates

vanlooverenkoen avatar Apr 20 '22 09:04 vanlooverenkoen

I have used kiwi 4.0.1 and following class registered with singleton instance. But its getting null instance, when background_locator callback method calls. Even though, I have already re-registered the same class. container.registerSingleton((c) => CustomSharedPrefs());

Null error

container = KiwiContainer();
container!.silent = true;
var **customSharedPrefs** = container!<CustomSharedPrefs>();

saravananmnm avatar May 06 '22 11:05 saravananmnm

Can you create the smallest working example in an other repo so I can run and inspect your code?

vanlooverenkoen avatar May 06 '22 11:05 vanlooverenkoen

Because of no response, I will close this ticket. Please provide the smallest working example to reopen the ticket.

vanlooverenkoen avatar Feb 15 '23 19:02 vanlooverenkoen