fetchPlacements static method

Future<ApphudPlacements> fetchPlacements()

Returns the placements from Product Hub > 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.

See documentation for details: https://docs.apphud.com/docs/placements For immediate access without awaiting SKProducts or ProductDetails, use rawPlacements() method.

Implementation

static Future<ApphudPlacements> fetchPlacements() async {
  final Map<dynamic, dynamic>? json =
      await _channel.invokeMethod<Map<dynamic, dynamic>>('fetchPlacements');
  if (json == null) {
    return ApphudPlacements(
      placements: const [],
      error: ApphudError(message: 'fetchPlacements error'),
    );
  }
  return ApphudPlacements.fromJson(json);
}