screen static method

Future<void> screen(
  1. String screenName, {
  2. Map<String, dynamic>? properties,
})

Implementation

static Future<void> screen(
  String screenName, {
  Map<String, dynamic>? properties,
}) async {
  // In-App Surface Filter tracker — double-duty: the screen name also
  // declares the in-app campaign surface when it matches a canonical key
  // (mirrors the web SDK where aegis.screen(name) feeds refreshOnEvent).
  // setCurrentSurface ignores non-surface names, so arbitrary screens are
  // analytics-only.
  AegisInApp().setCurrentSurface(screenName);
  // Dynamic Screens P2 — also capture the RAW screen name (un-normalized) for
  // free-form target_screens matching (kept verbatim, e.g. "storefront.cart").
  AegisInApp().setCurrentScreen(screenName);
  try {
    await _channel.invokeMethod('screen', {
      'screenName': screenName,
      'properties': properties ?? {},
    });
  } on PlatformException catch (e) {
    // ignore: avoid_print
    print('Failed to track screen: ${e.message}');
  }
}