boolVariationDetail static method Null safety
Returns the value of flag flagKey
for the current context as a bool, 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.
Implementation
static Future<LDEvaluationDetail<bool>> boolVariationDetail(String flagKey, bool defaultValue) async {
Map<String, dynamic>? result = await _channel.invokeMapMethod('boolVariationDetail', {'flagKey': flagKey, 'defaultValue': defaultValue });
if (result == null) {
return LDEvaluationDetail(defaultValue, -1, LDEvaluationReason.error());
}
bool? resultValue = result['value'];
if (resultValue == null) {
return LDEvaluationDetail(defaultValue, -1, LDEvaluationReason.error());
}
return LDEvaluationDetail(resultValue, result['variationIndex'] ?? -1, LDEvaluationReason._fromCodecValue(result['reason']));
}