Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR fixes an Android crash (issue #462) that occurs when null values are passed to setUserData through the MethodChannel. The fix implements a defense-in-depth approach by filtering out null values on the Dart side before sending them to the platform, and making the Android createBundleFromMap method null-safe to gracefully handle any null values that might slip through.
Key changes:
- Dart-side null filtering using the existing
_filterOutNullshelper forsetUserData - Android type signature updates to accept nullable values (
Map<String, Any?>) - Explicit null handling in Android's
createBundleFromMapwith an empty when branch - Comprehensive unit tests covering null field handling and regression scenarios
Reviewed changes
Copilot reviewed 4 out of 5 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| lib/facebook_app_events.dart | Applies _filterOutNulls to setUserData arguments before invoking platform method |
| android/.../FacebookAppEventsPlugin.kt | Updates type signatures to Map<String, Any?>, adds null case handling in createBundleFromMap, improves error message formatting |
| test/facebook_app_events_test.dart | Adds three comprehensive tests for setUserData null handling behavior |
| .gitignore | Consolidates ephemeral directory pattern to root gitignore |
| example/.gitignore | Removes iOS-specific ephemeral pattern (now covered by root gitignore) |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fix Android crash in setUserData when null values are passed over the MethodChannel (reported in #462).
Fixes #462