placements static method

Future<List<ApphudPlacement>> placements()

Asynchronously retrieves the paywall placements configured in Product Hub > Placements, potentially altered based on the user's involvement in A/B testing, if any. Awaits until the inner Stores products are loaded from the App Store or Google Play.

A placement is a specific location within a user's journey (such as onboarding, settings, etc.) where its internal paywall is intended to be displayed. See documentation for details: https://docs.apphud.com/docs/placements For immediate access without awaiting Stores products, use rawPlacements() method.

Returns: An array of ApphudPlacement objects, representing the configured placements.

Implementation

static Future<List<ApphudPlacement>> placements() async {
  final List<Map<dynamic, dynamic>>? placements =
      (await _channel.invokeMethod<List<dynamic>>('placements'))?.toMapList;

  if (placements != null) {
    return placements.map((json) => ApphudPlacement.fromJson(json)).toList();
  }
  return const [];
}