Skip to content

Add unknown to ReaderChange enum (#66)#66

Open
marcos930807 wants to merge 1 commit intosquare:mainfrom
marcos930807:feature/square_improves
Open

Add unknown to ReaderChange enum (#66)#66
marcos930807 wants to merge 1 commit intosquare:mainfrom
marcos930807:feature/square_improves

Conversation

@marcos930807
Copy link
Copy Markdown

@marcos930807 marcos930807 commented Mar 31, 2026

This PR adds support for an unmapped ReaderChange event value (unknown) in the Tap to Pay flow of the Square Mobile Payments Flutter SDK.

Problem

When the app transitions between background and foreground, the Tap to Pay reader reconnects and emits a ReaderChange event.

Currently, this event is value of unknown, which is not included in the ReaderChange enum. This causes a deserialization failure and we miss the event. Error:

Invalid argument(s): ⁠ unknown ⁠ is not one of the supported values: batteryDidBeginCharging, batteryDidEndCharging, batteryLevelDidChange, cardInserted, cardRemoved, firmwareUpdateDidFail, firmwareUpdatePercentDidChange, changedState, added, removed, batteryThreshold, batteryCharging, firmwareProgress

Solution

This PR adds the missing unknown value to the ReaderChange enum, allowing the SDK to safely deserialize all incoming events.

Benefits
Ensures the event stream remains stable during app lifecycle transitions (background ↔ foreground)
Preserves access to the reader reference included in the event
Allows consumers to fetch the latest reader state if needed, even when the event type is not explicitly mapped

It will be ideal that Native IOS SDK send the correct eventName but with this mapping at least we known that something "unknown" change on the Reader and we can fetch his current status.

* update enums.dart
* update models.g.dart
@marcos930807
Copy link
Copy Markdown
Author

@cesar-sosa-hol let me known if anythings else is needed here!. Thanks

@marcos930807 marcos930807 changed the title Add unknown to ReaderChange enum (#63) Add unknown to ReaderChange enum (#66) Apr 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant