getTreatmentWithConfig method

Future<SplitResult?> getTreatmentWithConfig(
  1. String key,
  2. Map<String, dynamic> attr
)

Implementation

Future<SplitResult?> getTreatmentWithConfig(
    String key, Map<String, dynamic> attr) async {
  Map<String, dynamic> attributes = {"key": key, "attributes": attr};

  try {
    var data =
        await _channel.invokeMethod('getTreatmentWithConfig', attributes);
    return SplitResult.fromJson({
      'splitName': key,
      'treatment': data['treatment'],
      'config': data['config'] == null ? null : jsonDecode(data['config'])
    });
  } catch (e, st) {
    print(e);
    print(st);
    return null;
  }
}