Skip to content

fix: Return null instead of Kotlin.Unit over method channel for AEPMessaging#159

Open
Psyaryu wants to merge 1 commit into
adobe:mainfrom
Psyaryu:main
Open

fix: Return null instead of Kotlin.Unit over method channel for AEPMessaging#159
Psyaryu wants to merge 1 commit into
adobe:mainfrom
Psyaryu:main

Conversation

@Psyaryu
Copy link
Copy Markdown

@Psyaryu Psyaryu commented May 11, 2026

Description

Empty return types in Kotlin functions return an object noted as Kotlin.Unit. which is not supported by Flutter BinaryMessenger .

flutter_aepmessaging throws a native exception regarding Kotlin.Unit being an unsupported type when calling Messaging.refershInAppMessages(). This native exception is never received on the Flutter side.

This update addresses all aepsdk_flutter 5.0.1 plugins passing Kotlin functions with undefined types to MethodChannel.Result by explicitly passing null

The plugins affected are

  • flutter_aepmessaging

Related Issue

Motivation and Context

While refreshing Adobe In-App Messages on Android via the Dart SDK, this issue was found. It is unknown the impact of the issue.

If a critical issue is not resolved, at least there's no more errors being reported in the logs.

How Has This Been Tested?

This issue is evident by writing an integration test for the example project and running the integration test on an Android device

import 'package:flutter_aepmessaging/flutter_aepmessaging.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:integration_test/integration_test.dart';

import '../lib/main.dart' as app; // Import your app's main

void main() {
  IntegrationTestWidgetsFlutterBinding.ensureInitialized();

  testWidgets('Android refreshInAppMessages does not throw exception',
      (tester) async {
    app.main();
    await tester.pumpAndSettle();

    try {
      Messaging.refreshInAppMessages();
    } on Exception {
      // Platform exception is never returned to flutter, so the logs have to be shown instead
      fail(
          'No exceptions should be thrown for calling [${Messaging.refreshInAppMessages}]');
    }
  });
}

Screenshots (if appropriate):

Before:
Screenshot 2026-05-11 at 8 07 37 AM

After:
Screenshot 2026-05-11 at 8 07 49 AM

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • I have signed the Adobe Open Source CLA.
  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have read the CONTRIBUTING document.
  • I have added tests to cover my changes.
  • All new and existing tests passed.

@Psyaryu Psyaryu changed the title fix: Return Kotlin.Unit over method channel for AEPMessaging fix: Return null instead of Kotlin.Unit over method channel for AEPMessaging May 11, 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