Skip to content

v3: singularize the remaining plural enum names #1652

Closed

Description

@spydon

Summary

Dart enum names should be singular, since the type names one value rather than the set. Most of this repository already follows that: of 51 distinct enums, only a handful are plural, and all of them are ports of realtime-js / gotrue-js names rather than deliberate choices.

#1404 fixed the first one (SocketStates → SocketState) because it was in the way of that PR. This issue covers the rest.

The remaining plural enums

Enum Location Exported? Breaking?
ChannelStates realtime_client/lib/src/constants.dart:46 No No
ChannelEvents realtime_client/lib/src/constants.dart:48 No No
RealtimeListenTypes realtime_client/lib/src/types.dart:116 No, explicitly hiden No
PostgresTypes realtime_client/lib/src/transformers.dart:8 Yes Yes

Only PostgresTypes is reachable by consumers, so only it actually needs to wait for v3. The other three are already unreachable:

  • ChannelStates is omitted from the show list on the src/constants.dart export. It only ever appears as the private RealtimeChannel._state field, surfaced through the isClosed / isErrored / isJoined / isJoining / isLeaving getters, so it never appears in a public signature.
  • ChannelEvents is likewise omitted from that show list. Its only signature use is @internal Push push(...).
  • RealtimeListenTypes is named in the hide clause on the src/types.dart export. Its only signature use is @internal Future<ChannelResponse> send(...).

Two extensions should be renamed alongside their enums: ChannelEventsExtended and ToType (on RealtimeListenTypes).

Proposed change

  • ChannelStates → ChannelState
  • ChannelEvents → ChannelEvent
  • RealtimeListenTypes → RealtimeListenType
  • PostgresTypes → PostgresType

None of the enum values change, and no behaviour changes. ChannelEvents.eventName() keeps producing the same phx_* wire strings.

Because the first three are already internal, they can land before v3. PostgresTypes is the only one that needs the major version.

Capability matrix

None of the four are currently registered in sdk-compliance.yaml, and the symbol extractor picks up all four today, so a rename will trip the Check public API against capability matrix job the same way #1404 did.

The extractor skips @internal declarations (verified: RealtimeClient.disconnectOnEmptyChannelsAfter and RealtimeChannel.send are both absent from its output). So for the three internal enums, adding @internal is both the accurate annotation and enough to keep them out of the matrix. PostgresType is genuinely public and should be registered under the appropriate realtime.* feature.

Also plural, outside this scope

  • AuthenticatorAssuranceLevels (gotrue/lib/src/types/mfa.dart:354) has the same defect and is public: it types the currentLevel and nextLevel fields on the MFA types. Renaming it to AuthenticatorAssuranceLevel is breaking and would belong in v3 too. Left out of the table above because it is gotrue rather than realtime, but worth folding in if this is done as one sweep.
  • SupabaseEventTypes is already @Deprecated, so it needs nothing beyond eventual removal.
  • FactorStatus, RealtimeHeartbeatStatus, and RealtimeSubscribeStatus end in s but are singular ("status"), and LoadTableSnapshots names a set selection (all / refs) where the plural reads correctly. No change needed for any of these.

Context

Tracked under the v3 umbrella (#1278). Follow-up to #1404.

Activity

  1. added
    enhancement
    realtime
    on Aug 5, 2026
  2. added a commit that references this issue on Aug 6, 2026
    31c1be3
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementrealtimev3

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions