setTargetingContext method

  1. @override
Future<InappifySdkResult<void>> setTargetingContext(
  1. InappifyTargetingContextRequest request
)
inherited

Updates runtime country or app-version targeting inputs.

Implementation

@override
Future<InappifySdkResult<void>> setTargetingContext(
  InappifyTargetingContextRequest request,
) {
  final country = request.country?.trim().toUpperCase();
  final appVersion = request.appVersion?.trim();
  return _run<void>(
    'setTargetingContext',
    action: () async {
      await _bridge.call(
        'setTargetingContext',
        positionalArguments: <Object?>[
          <String, Object?>{
            if (country != null) 'country': country,
            if (appVersion != null) 'appVersion': appVersion,
          },
        ],
      );
      if (country != null) _country = country;
      if (appVersion != null) _appVersion = appVersion;
      _offerings = null;
    },
  );
}