Issue
I need to store a var which is a File. I tryed these options:
var selectedFolder by remember { mutableStateOf(null) }
var selectedFolder by remember { mutableStateOf(File()) }
None of them works, both give compiler exceptions. The first one gives:
Type mismatch.
Required:
Nothing?
Found:
File
and the second one gives:
Property delegate must have a 'getValue(Nothing?, KProperty*>)' method. None of the following functions are suitable.
What is the correct way to store a object in a by remember var in Compose?
Solution
You can define selectedFolder
variable like this.
var selectedFolder by remember { mutableStateOf<File?>(null) }
Answered By - Abdullah Javed
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.