Open
Description
This is a follow up from #500
This also relates to Kotlin/kotlinx.serialization#2223
I also have dynamic content that can be different types:
{
"value": "someValue"
}
vs
{
"value": {
"version": 0,
"content": "someValue"
}
}
The only way I found to make it work is to use the internal API:
@file:Suppress(
"CANNOT_OVERRIDE_INVISIBLE_MEMBER",
"INVISIBLE_MEMBER",
"INVISIBLE_REFERENCE",
)
val data = documentSnaphshot.encodedData()
data as Map<String, Any?>
data.forEach {
if (it.value is String) {
// case 1
} else if (it.value is Map<*, *>) {
// case 2
} else {
error("expected a string or a map")
}
}
From #500 (comment), I understand, this is currently dangerous because the returned data contains native NativeTimestamp
values that have different types in commonMain
but could those be updated to always return dev.gitlive.firebase.firestore.Timestamp
instead?
Metadata
Metadata
Assignees
Labels
No labels