engageapp_inapp 0.1.0
engageapp_inapp: ^0.1.0 copied to clipboard
EngageApp full-screen in-app takeover SDK for Flutter — fetch and render native full-screen campaign messages when your app foregrounds.
engageapp_inapp (Flutter) #
Full-screen in-app takeover SDK for Flutter apps. When you run an EngageApp campaign through an in-app channel, this SDK fetches the pending takeover when your app foregrounds and renders it natively.
Setup #
Add a navigator key to your MaterialApp so the SDK can present takeovers, then
initialise and identify:
final navigatorKey = GlobalKey<NavigatorState>();
void main() {
EngageInApp.instance.init(EngageInAppConfig(
publishableKey: 'pk_xxx', // safe to ship in the app
apiBaseUrl: 'https://api.engageapp.xyz',
navigatorKey: navigatorKey,
));
EngageInApp.instance.setHandlers(
onButtonTap: (action, _) {
if (action.type == 'deeplink') myRouter.go(action.value);
if (action.type == 'url') launchUrl(Uri.parse(action.value));
},
);
runApp(MyApp(navigatorKey: navigatorKey));
}
// After sign-in:
await EngageInApp.instance.identify('user-123', firstName: 'Ada');
// On every app foreground / entry (e.g. from a WidgetsBindingObserver):
await EngageInApp.instance.onAppForeground();
Delivery is pull-based: a takeover is shown the next time the app foregrounds after the campaign sends it. Impressions, clicks and dismissals are reported back automatically.
Identity verification (optional, anti-spoofing) #
If you enable in-app identity verification for your workspace, pass the HMAC your backend computes so the SDK can prove the user's identity:
// On your server: hmacSha256Hex(secret, externalId)
await EngageInApp.instance.identify('user-123', identityHash: '<hex digest>');
The SDK sends it as X-Identity-Hash; requests with a missing/invalid hash are
rejected when verification is required.
Development #
Requires the Flutter SDK (>= 3.27).
flutter pub get
flutter test # unit + widget tests