You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* Platform specific object for storing encoded data that can be used for methods that explicitly require an object.
16
16
* This is essentially a [Map] of [String] and [Any]? (as represented by [raw]) but since [encode] gives a platform specific value, this method wraps that.
17
17
*
18
-
* Created using [encodeAsObject]
18
+
* Created using [encodeAsObject]. It is not recommended to encode to this manually.
19
19
*/
20
20
expectclassEncodedObject {
21
-
companionobject {
22
-
val emptyEncodedObject:EncodedObject
23
-
}
24
-
25
21
val raw:Map<String, Any?>
26
22
}
27
23
@@ -45,13 +41,24 @@ inline fun <reified T> encode(value: T, shouldEncodeElementDefault: Boolean): An
if (value isMap<*, *> && value.keys.any { it !isString }) {
50
51
throwIllegalArgumentException("$value is a Map containing non-String keys. Must be of the form Map<String, Any?>")
51
52
}
52
53
val encoded = encode(strategy, value, buildSettings) ?:throwIllegalArgumentException("$value was encoded as null. Must be of the form Map<String, Any?>")
53
54
return encoded.asNativeMap()?.asEncodedObject() ?:throwIllegalArgumentException("$value was encoded as ${encoded::class}. Must be of the form Map<String, Any?>")
54
55
}
56
+
57
+
/**
58
+
* Encodes data as an [EncodedObject].
59
+
* This is not recommended for manual use, but may be done by the library internally.
60
+
* @throws IllegalArgumentException if [value] is not valid as an [EncodedObject] (e.g. not encodable in the form Map<String:Any?>
0 commit comments