https://kotlinlang.org
Join Slack
would I be able to use multiplatform for tizen and webos?
m

Marc Javier

over 3 years ago
would I be able to use multiplatform for tizen and webos?
m
d
+2
  • 4
  • 6
  • 360
Injecting dependencies in ViewModel with inheritance using Hilt without constructor parameters Hell...
s

sk eat

over 1 year ago
Injecting dependencies in ViewModel with inheritance using Hilt without constructor parameters Hello, I need some advice on a problem I'm facing. I have a feature A with sub-features AA and AB. I want to separate the logic of AA and AB by creating a
BaseViewModel
and then have
AAViewModel
and
ABViewModel
inherit from it. We are using Hilt in our project to inject dependencies into the
BaseViewModel
. Here is an example of what I am trying to achieve:
kotlin

@HiltViewModel
open class BaseViewModel @Inject constructor(
    private val sampleUseCase: SampleUseCase,
    private val anotherUseCase: AnotherUseCase
) : ViewModel() {
    // BaseViewModel logic
}
The problem arises when I try to implement the class that inherits from `BaseViewModel`:
kotlin

@HiltViewModel
class AAViewModel @Inject constructor(
    private val secondSampleUseCase: SecondSampleUseCase
) : BaseViewModel(
    // error! Too many parameters to pass
) {
    // AAViewModel logic
}
When inheriting from
BaseViewModel
, I need to pass many member variables through the constructor, which is cumbersome and error-prone. I want to eliminate the constructor parameters. How can I achieve this using Hilt?
not kotlin but kotlin colored 2
🧵 1
s
r
+3
  • 5
  • 5
  • 360
I’ll post my question in a thread cause the code blocks will bloat the view here
k

Kevin

over 2 years ago
I’ll post my question in a thread cause the code blocks will bloat the view here
k
m
  • 2
  • 5
  • 360
Is there a way to force serialization to use `ksp` instead of `kapt`? I have a module that usess `ks...
d

dawidhyzy

over 3 years ago
Is there a way to force serialization to use
ksp
instead of
kapt
? I have a module that usess
ksp
only and fails after adding
kapt
d
j
  • 2
  • 11
  • 360
“You can ask Kotest to run specs in parallel to take advantage of modern cpus with several cores by ...
c

christophsturm

about 5 years ago
“You can ask Kotest to run specs in parallel to take advantage of modern cpus with several cores by setting the parallelism level (default is 1).. Tests inside a spec are always executed sequentially.” is that still true?
c
s
  • 2
  • 19
  • 360
Is it safe to store the Android Application Context in a static variable? Every time I make a librar...
s

spierce7

almost 7 years ago
Is it safe to store the Android Application Context in a static variable? Every time I make a library that does this, I get a warning that it's not safe, causes memory leaks, and would break instant run. As long as this is done with an Application Context, I can't think of a reason this wouldn't be ok. Can anyone argue otherwise?
stackoverflow 2
s
v
+4
  • 6
  • 12
  • 360
We have build issues for iOS `Release` Builds since upgrading to Kotlin 2.1.0 with SKIE 0.10.0. I cr...
m

Matthias

11 months ago
We have build issues for iOS
Release
Builds since upgrading to Kotlin 2.1.0 with SKIE 0.10.0. I created a StackOverflow question. Anybody an idea? https://stackoverflow.com/questions/79358761/kmm-app-with-skie-ios-build-with-releaseconfiguration-fails-when-linking-un
m
t
j
  • 3
  • 29
  • 359
Hello! What is the best way to load images from URLs in Compose Web (WasmJS)? Coil, OkHttp, and Ktor...
z

Zhang Zihan

over 1 year ago
Hello! What is the best way to load images from URLs in Compose Web (WasmJS)? Coil, OkHttp, and Ktor are not available in WasmJs. Do I have to write external JS code?
z
k
+2
  • 4
  • 5
  • 359
are there any best practices, how to test custom components in Compose? I have a custom `MyTextField...
p

Peter Mandeljc

almost 3 years ago
are there any best practices, how to test custom components in Compose? I have a custom
MyTextField
composable and I would like somehow send text directly to the root of it. Atm I'm getting
Failed to assert the following: (SetText is defined)
.
p
a
l
  • 3
  • 10
  • 359
I have a Multiplatform app with desktop(compose), Android app and web. When I run the desktop modul...
z

Zeeshan Syed

over 2 years ago
I have a Multiplatform app with desktop(compose), Android app and web. When I run the desktop module in windows directly from Idea (Play Button), then the JVM application opens. But, if I run
:packageMsi
, install
.msi
and try to run the
.exe
file, then it is not opening. It doesn't even throw any error. How to fix this and how to check logs of an executive application?
z
v
+2
  • 4
  • 11
  • 359
Previous190191192Next

kotlinlang

A modern programming language that makes developers happier.

Powered by