getFlowForDefaultAudience method
Future<AdaptyFlow>
getFlowForDefaultAudience({
- required String placementId,
- @Deprecated('Has no effect for flows. Starting Adapty SDK 4.0.0 the locale is applied when the flow view is built — ' 'pass it to AdaptyUI.createFlowView or AdaptyUIFlowPlatformView instead.') String? locale,
- AdaptyFlowFetchPolicy? fetchPolicy,
This method enables you to retrieve the paywall from the Default Audience without having to wait for the Adapty SDK to send all the user information required for segmentation to the server.
Parameters:
placementId: the identifier of the desired placement. This is the value you specified when you created the placement in the Adapty Dashboard.locale: has no effect. Starting with 4.0.0 a flow is localized when its view is built, so pass the locale toAdaptyUI.createFlowVieworAdaptyUIFlowPlatformViewinstead.fetchPolicy: the fetch policy of the paywall.
Returns:
- the AdaptyFlow object. This model contains the list of the products ids, flow’s identifier, custom payload, and several other properties.
Implementation
Future<AdaptyFlow> getFlowForDefaultAudience({
required String placementId,
@Deprecated(
'Has no effect for flows. Starting Adapty SDK 4.0.0 the locale is applied when the flow view is built — '
'pass it to AdaptyUI.createFlowView or AdaptyUIFlowPlatformView instead.',
)
String? locale,
AdaptyFlowFetchPolicy? fetchPolicy,
}) {
_warnIfFlowLocalePassed(locale, 'getFlowForDefaultAudience');
return _invokeMethod<AdaptyFlow>(
Method.getFlowForDefaultAudience,
(data) {
final flowMap = data as Map<String, dynamic>;
return AdaptyFlowJSONBuilder.fromJsonValue(flowMap);
},
{
Argument.placementId: placementId,
if (locale != null) Argument.locale: locale,
if (fetchPolicy != null) Argument.fetchPolicy: fetchPolicy.jsonValue,
},
);
}