This is because the coroutine launches the snackbar with the view given in WalletHome, and if the use is in, say, the receive fragment, it cannot find this view in which to launch the snackbar.
Error:
2021-08-26 18:52:37.435 20721-20905/com.goldenraven.padawanwallet.debug E/AndroidRuntime: FATAL EXCEPTION: DefaultDispatcher-worker-4
Process: com.goldenraven.padawanwallet.debug, PID: 20721
java.lang.IllegalArgumentException: No suitable parent found from the given view. Please provide a valid view.
at com.google.android.material.snackbar.Snackbar.makeInternal(Snackbar.java:198)
at com.google.android.material.snackbar.Snackbar.make(Snackbar.java:157)
at com.goldenraven.padawanwallet.utils.SnackbarsKt.fireSnackbar(Snackbars.kt:31)
at com.goldenraven.padawanwallet.utils.SnackbarsKt.fireSnackbar$default(Snackbars.kt:15)
at com.goldenraven.padawanwallet.wallet.wallet.WalletHome$onViewCreated$2$1$1.invokeSuspend(WalletHome.kt:95)
at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:106)
at android.os.Handler.handleCallback(Handler.java:883)
at android.os.Handler.dispatchMessage(Handler.java:100)
at android.os.Looper.loop(Looper.java:214)
at android.app.ActivityThread.main(ActivityThread.java:7615)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:492)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:964)
This is because the coroutine launches the snackbar with the view given in
WalletHome
, and if the use is in, say, the receive fragment, it cannot find this view in which to launch the snackbar.Error: