Skip to content

Add Kotlin Flow extensions to maps-ktx and maps-v3-ktx #111

@arriolac

Description

@arriolac

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

  • GoogleMap
  • StreetViewPanorama

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    help wantedWe'd love to have community involvement on this issue.releasedtype: feature request‘Nice-to-have’ improvement, new feature or different behavior or design.

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions