parameterToString static method

String? parameterToString(
  1. dynamic value
)

Format the given parameter object into string.

Implementation

static String? parameterToString(dynamic value) {
  if (value == null) {
    return null;
  } else if (value is DateTime) {
    // shouldn't ever be used, replaced by direct call
    return Uri.encodeComponent(value.toUtc().toIso8601String());
  } else if (value is String || value is num || value is bool) {
    return value.toString();
  }

  if (value is FeatureValueType) {
    return value.toJson().toString();
  }
  if (value is RoleType) {
    return value.toJson().toString();
  }
  if (value is RolloutStrategyAttributeConditional) {
    return value.toJson().toString();
  }
  if (value is RolloutStrategyFieldType) {
    return value.toJson().toString();
  }
  if (value is SSEResultState) {
    return value.toJson().toString();
  }
  if (value is StrategyAttributeCountryName) {
    return value.toJson().toString();
  }
  if (value is StrategyAttributeDeviceName) {
    return value.toJson().toString();
  }
  if (value is StrategyAttributePlatformName) {
    return value.toJson().toString();
  }
  if (value is StrategyAttributeWellKnownNames) {
    return value.toJson().toString();
  }

  return jsonEncode(value);
}