jsonVariationDetail static method Null safety

Future<LDEvaluationDetail<LDValue>> jsonVariationDetail(
  1. String flagKey,
  2. LDValue defaultValue

Returns the value of flag flagKey for the current context as an LDValue, along with information about the resultant value.

See LDEvaluationDetail for more information on the returned value. Note that LDConfigBuilder.evaluationReasons must have been set to true to request the additional evaluation information from the backend.


static Future<LDEvaluationDetail<LDValue>> jsonVariationDetail(String flagKey, LDValue defaultValue) async {
  Map<String, dynamic>? result = await _channel.invokeMapMethod('jsonVariationDetail', {'flagKey': flagKey, 'defaultValue': defaultValue.codecValue()});
  if (result == null) {
    return LDEvaluationDetail(defaultValue, -1, LDEvaluationReason.error());
  return LDEvaluationDetail(LDValue.fromCodecValue(result['value']), result['variationIndex'] ?? -1, LDEvaluationReason._fromCodecValue(result['reason']));