activateFeature method

Future<bool?> activateFeature(
  1. String visitorCode,
  2. dynamic featureKeyOrID
)

Implementation

Future<bool?> activateFeature(String visitorCode, var featureKeyOrID) async {
  try {
    if (featureKeyOrID is int) {
      return await _channel.invokeMethod("activateFeature", <String, dynamic>{
        "visitorCode": visitorCode,
        "featureID": featureKeyOrID,
        "siteCode": this.siteCode
      });
    } else {
      return await _channel.invokeMethod("activateFeature", <String, dynamic>{
        "visitorCode": visitorCode,
        "featureKey": featureKeyOrID,
        "siteCode": this.siteCode
      });
    }
  } on PlatformException catch (e) {
    switch (e.code) {
      case "SDKNotReady":
        throw SDKNotReady();
      case "FeatureConfigurationNotFound":
        throw FeatureConfigurationNotFound();
      case "NotTargeted":
        throw NotTargeted();
      case "NotActivated":
        throw NotActivated();
      default:
        throw Exception(e);
    }
  }
}