-
Notifications
You must be signed in to change notification settings - Fork 15
Description
Prerequisites
- This is not a Security Disclosure, otherwise please follow the guidelines in Security Policy.
- I have searched in this repository's issues to see if it has already been reported.
- I have updated to the latest released version of the SDK and the issue still persists.
Bug summary
In your /example project, the MobileCore.initializeWithAppId() call is not awaited which is hiding an issue that was introduced in v5.x of this package.
When this call is awaited within a Future, previously in v4.x of this package this didn't cause any problems either with running the app or with Hot Restarts. After moving to v5.x and addressing the breaking changes, when either the initialize or initializeWithAppId methods are awaited within a Future, these calls hang and prevent subsequent code execution upon Hot Restart (not reload).
Environment
[✓] Flutter (Channel stable, 3.32.5, on macOS 15.7.1 24G231 darwin-arm64, locale en-US) [368ms]
• Flutter version 3.32.5 on channel stable at /path/to/flutter-3-32
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision fcf2c11572 (4 months ago), 2025-06-24 11:44:07 -0700
• Engine revision dd93de6fb1
• Dart version 3.8.1
• DevTools version 2.45.1
[✓] Android toolchain - develop for Android devices (Android SDK version 36.0.0) [1,213ms]
• Android SDK at /path/to/Library/Android/sdk
• Platform android-36, build-tools 36.0.0
• Java binary at: /path/to/JDK/Contents/Home/bin/java
This JDK is specified in your Flutter configuration.
To change the current JDK, run: `flutter config --jdk-dir="path/to/jdk"`.
• Java version OpenJDK Runtime Environment (build 17.0.2+8-86)
• All Android licenses accepted.
[✓] Xcode - develop for iOS and macOS (Xcode 16.4) [695ms]
• Xcode at /Applications/Xcode-16.4.0.app/Contents/Developer
• Build 16F6
• CocoaPods version 1.16.2Steps to reproduce
See my forked repro branch here.
cd example
flutter run lib/main.dart --dart-define=APP_ID=<YOUR_APP_ID>Set a breakpoint on the print statement added after the awaited initializeWithAppId call, Hot Restart (NOT reload) the Flutter app and notice that code execution stops at the awaited call.
Current behavior
See this updated snippet taken from the example, where the Futures are now awaited (as they should be):
Future<void> _initializeAEPMobileSdk() async {
await MobileCore.setLogLevel(LogLevel.trace);
await MobileCore.initializeWithAppId(appId: const String.fromEnvironment('APP_ID'));
print('we got here'); // <-- this is never called upon Hot Restart, any code below the above line after Hot Restarting is swallowed and never executed
}Expected behavior
flutter_aepcore should not break in this way when the Future is awaited. This prevents any code directly after the initialization methods from being called when Hot Restarting the app, slowing down development time when you must constantly stop and rebuild to see changes.
Anything else?
No response