Fix Flutter realtime message list parsing#1547
Conversation
Greptile SummaryThis PR fixes Flutter realtime message parsing to handle server payloads where
Confidence Score: 5/5The change is safe to merge; it narrows an existing runtime crash into a handled code path and the new test suite covers all documented server formats including edge cases. The logic in _stringListFrom correctly handles all documented server formats. The only noteworthy point is a minor inconsistency in _isArrayIndexKey where negative integer strings pass the guard while negative int values do not, but this edge case does not arise with real JSON payloads. No files require special attention. Important Files Changed
Reviews (2): Last reviewed commit: "Fix Flutter realtime message list parsin..." | Re-trigger Greptile |
fa8ae02 to
e5ad7ee
Compare
Fixes appwrite/sdk-for-flutter#302
Updates the generated Flutter
RealtimeMessage.fromMapimplementation to safely parseeventsandchannelswhen realtime payloads provide those fields as maps instead of lists.The parser now supports:
{ "0": "event" }.{ "event": true }Validation:
docker run --rm -v "$(pwd)":/app -w /app php:8.3-cli php example.php flutterflutter test test/src/realtime_message_test.dartflutter analyze lib/src/realtime_message.dart test/src/realtime_message_test.dartuvx djlint templates/ --lint