Category "kotlin"

How to test async function in Mockk Kotlin

I want to test this function. suspend fun fetchTwoDocs() = coroutineScope { val deferredOne = async { fetchDoc(1) } val deferred

When to use let/run/apply/with/also when an object is null?

I want to run a block of code depending if the variable is null or not, but I still don't know when to use let,run...etc. I want something like this: myVar?.xxx

Quarkus: connect to cloudsql db (gcp) with native image

I've set up a prod configuration for my datasource to connect to a GCP MySQL instance, basically following this tutorial: https://quarkus.io/guides/deploying-to

Android Studio memory profiler have some serious memory issues

I am trying to fix some memory leaks in my apps but I am always fighting with memory profiler instability itself instead of being able to focus on my task. Inte

java.lang.IllegalStateException: No request transformation found: XYZ in ktor

Hey I am working in ktor. I am getting weird issue and I am trying to find the issue, but unable to get the proper reference. androidMain AndroidHttpClient.kt p

Kotlin sort one List with key and Enum with key and order

I receive data from Request information as list data (List) below code. That data has a "key" parameter by which I want to sort it. data class ApplianceSetting(

Can't show/hide menu items on Kotlin - Android Studio

my application has a menu of 3 options, and what I want is that according to a condition that I define, it shows only 2 options, or it shows 3. I have tried all

How to open file with custom extension on android 11 via action open document

How i can open file with my extension settings. Framework see this file,but i can't open it. when i set mime_type / all ok,but it allow to open all file types,b

Convert string with separator to data class instance

I have a string separated by ";" like this: var dataString: String = "Juan;25;Argentina" And I want to convert it to this sample data class: data class Person

Why I am not able to use mobile authentication with firebase in jetpack compose?

I am try to learning android jetpack compose, I have simple app, and I want to use mobile authentication with firebase for my project. I am using MVVM in the pr

Google SSO login is not working in my Android app for the last one week, Showing the account selection dialog continuously

From the last one week the Google SSO login is not working in my Android app and it keeps loading the account selection dialog even after selecting the account.

.class file too large

I have a kotlin file with a function that returns a list of strings with 10,000 elements, but when compiling it generates an error, saying that the .class file

Corda - Checking equality of AbstractParty, Party and AnonymousParty

In Corda we have the following type hierarchy for providing ledger identities: abstract class AbstractParty(val owningKey: PublicKey): Destination { /** An

navigateUp() and popBackStack() not working. Instead, they reload the current fragment

I am trying to navigate up the backstack. On calling the method view?.findNavController().navigateUp() and logging the destination using view?.findNavController

How to generate CREATE TABLE from Kotlin data class

In Kotlin, I'd like to generate a Postgres CREATE TABLE from my data class. For instance, if we have the following: data class Thing(name: String, quantity: Int

How to generate CREATE TABLE from Kotlin data class

In Kotlin, I'd like to generate a Postgres CREATE TABLE from my data class. For instance, if we have the following: data class Thing(name: String, quantity: Int

ComposeView with dynamic height flickering inside ConstraintLayout

I have a ComposeView inside a ConstraintLayout like that: <androidx.compose.ui.platform.ComposeView android:id="@+id/compose" android:lay

Getting android.app.ForegroundServiceStartNotAllowedException in Android 12 (SDK 31)

I upgraded my apps targetSdkVersion and compileSdkVersion to SDK 31, and started receiving the following crash in app in a service that updates widget in backgr

How to create a folder and save files in root directory from api 30 android?

note: when I say root, I mean the folder where the download, documents, music, android folders are located, etc… Environment.getExternalStoragePublicDire

Type mismatch: inferred type is String? but String was expected error in projects after flutter upgrade

I updated my Flutter version to 3.0.0 and then any project I run it gives me this error e: C:\src\.pub-cache\hosted\pub.dartlang.org\agora_rtc_engine-4.2.0\andr