rawPlacements static method

Future<List<ApphudPlacement>> rawPlacements()

A list of paywall placements, potentially altered based on the user's involvement in A/B testing, if any. 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.

Important: This function doesn't await until inner Stores products are loaded. That means paywalls may or may not have inner SKProduct / ProductDetails at the time you call this function.

Important: This function will return empty array if user is not yet loaded, or placements are not set up in the Product Hub.

To get placements with awaiting for native Stores products, use await Apphud.placements() or Apphud.placementsDidLoadCallback(...) functions.

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

Implementation

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

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