googlemaps / googlemaps/android-maps-ktx

Add Kotlin KSerializer for LatLng

Open
#108 5 comments 4 reactions 1 assignee Claimed by @arriolac View on GitHub
priority: p2 type: feature request
Dominant language
Kotlin
Stars
359
Forks
57
Avg merge
2d 15h
Merged PRs (30d)
9

Description

**Is your feature request related to a problem? Please describe.**
In my fairly pure Kotlin app I need to persist various types of data to disk, including `List`. I am switching to Kotlin serialization to do this, as it provides a straightforward framework that has recently seen a stable release. For now I intend to use stable Json-based Kotlin serialization, but may switch to a more compact format such as CBOR or protobuf as the respective library artifacts stabilize. LatLng from google-maps is a Java class and needs an external KSerializer to enable this.

**Describe the solution you'd like**
Add performant KSerializer implementation for LatLng that supports different Kotlin serialization formats, perhaps using the approach from https://github.com/Kotlin/kotlinx.serialization/blob/master/docs/serializers.md#hand-written-composite-serializer

**Describe alternatives you've considered**
I am writing my own KSerializer based on https://github.com/Kotlin/kotlinx.serialization/blob/master/docs/serializers.md#composite-serializer-via-surrogate. It is not as performant as the suggested hand-written composite serializer approach. It seems unnecessary for app developers to reinvent the wheel - LatLng is essentially a POJO that lends itself to serialization.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.