Overview
This is a tracking bug for adding Kotlin Flow support to methods within the maps-ktx and maps-v3-ktx packages where applicable.
Background
Version 2.1.0 of the KTX library added support for Kotlin flow through the introduction of the method cameraEvents(). As a continuation to this work, this issue is for adding extension methods returning Kotlin flows for methods that can be modeled as such. For example, set listener methods (e.g. setOnCameraIdleListener(), setOnMapClickListener(), and so on) are good candidates.
Design
While cameraEvents() added support for Kotlin flow, this method wrapped several set listener methods and should be improved upon to aid in predictability for the Kotlin flow extension APIs. Specifically, wrapped methods should have a unique Kotlin flow API. In other words, the relationship between the extended method and the extension methods should be one-to-one, and not one-to-many. Since cameraEvents() does not comply to this design, it should be removed or marked as deprecated in favor of the API convention described here.
Method Naming
- The
setOn prefix should be dropped as well as the Listener suffix. Additionally, Events should be added as a suffix
- Examples:
setOnCameraIdleListener() → cameraIdleEvents()
setOnMapClickListener() → mapClickEvents()
Developing
Classes to Extend
Contributing
Thinking of contributing? Awesome! Leave a comment below on what you'd like to add/work on so it's accounted for or any feedback on the design if you have any.
Overview
This is a tracking bug for adding Kotlin Flow support to methods within the
maps-ktxandmaps-v3-ktxpackages where applicable.Background
Version 2.1.0 of the KTX library added support for Kotlin flow through the introduction of the method
cameraEvents(). As a continuation to this work, this issue is for adding extension methods returning Kotlin flows for methods that can be modeled as such. For example, set listener methods (e.g.setOnCameraIdleListener(),setOnMapClickListener(), and so on) are good candidates.Design
While
cameraEvents()added support for Kotlin flow, this method wrapped several set listener methods and should be improved upon to aid in predictability for the Kotlin flow extension APIs. Specifically, wrapped methods should have a unique Kotlin flow API. In other words, the relationship between the extended method and the extension methods should be one-to-one, and not one-to-many. SincecameraEvents()does not comply to this design, it should be removed or marked as deprecated in favor of the API convention described here.Method Naming
setOnprefix should be dropped as well as theListenersuffix. Additionally,Eventsshould be added as a suffixsetOnCameraIdleListener()→cameraIdleEvents()setOnMapClickListener()→mapClickEvents()Developing
kotlin-flowClasses to Extend
Contributing
Thinking of contributing? Awesome! Leave a comment below on what you'd like to add/work on so it's accounted for or any feedback on the design if you have any.