Skip to content

Issue/462 android parameter error#463

Merged
DennisAlund merged 4 commits intomainfrom
issue/462-android-parameter-error
Dec 16, 2025
Merged

Issue/462 android parameter error#463
DennisAlund merged 4 commits intomainfrom
issue/462-android-parameter-error

Conversation

@DennisAlund
Copy link
Member

Fix Android crash in setUserData when null values are passed over the MethodChannel (reported in #462).

  • Filters out null user-data fields on the Dart side before invoking the platform method.
  • Makes Android createBundleFromMap null-safe by skipping null entries to prevent NPEs.
  • Adds unit tests covering setUserData payload behavior (ensures no null values are sent) and a regression test for the crash scenario.

Fixes #462

Copilot AI review requested due to automatic review settings December 16, 2025 09:10
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 _filterOutNulls helper for setUserData
  • Android type signature updates to accept nullable values (Map<String, Any?>)
  • Explicit null handling in Android's createBundleFromMap with 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.

@DennisAlund DennisAlund merged commit 10c5d3a into main Dec 16, 2025
7 checks passed
@DennisAlund DennisAlund deleted the issue/462-android-parameter-error branch December 16, 2025 09:18
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.

[Bug]: Android NPE after 0.22.0 upgrade

2 participants