getTreatmentWithConfig method

  1. @override
Future<SplitResult> getTreatmentWithConfig({
  1. required String matchingKey,
  2. required String? bucketingKey,
  3. required String splitName,
  4. Map<String, dynamic> attributes = const {},
})

Implementation

@override
Future<SplitResult> getTreatmentWithConfig(
    {required String matchingKey,
    required String? bucketingKey,
    required String splitName,
    Map<String, dynamic> attributes = const {}}) async {
  Map? treatment = (await methodChannel.invokeMapMethod(
          'getTreatmentWithConfig',
          _buildParameters(matchingKey, bucketingKey,
              {'splitName': splitName, 'attributes': attributes})))
      ?.entries
      .first
      .value;
  if (treatment == null) {
    return _controlResult;
  }

  return SplitResult(treatment['treatment'], treatment['config']);
}