set method

String? set(
  1. String key,
  2. Object value
)

Returns null on success, or a description of the validation failure.

Implementation

String? set(String key, Object value) {
  switch (key) {
    case 'readyTimeoutMs':
      final v = _asPositiveInt(value);
      if (v == null) return 'readyTimeoutMs must be a positive int';
      readyTimeoutMs = v;
    case 'attachProbeTimeoutMs':
      final v = _asPositiveInt(value);
      if (v == null) return 'attachProbeTimeoutMs must be a positive int';
      attachProbeTimeoutMs = v;
    case 'launchTimeoutMs':
      final v = _asPositiveInt(value);
      if (v == null) return 'launchTimeoutMs must be a positive int';
      launchTimeoutMs = v;
    case 'settleCeilingMs':
      final v = _asPositiveInt(value);
      if (v == null) return 'settleCeilingMs must be a positive int';
      settleCeilingMs = v;
    case 'postActionSettleMs':
      final v = _asPositiveInt(value);
      if (v == null) return 'postActionSettleMs must be a positive int';
      postActionSettleMs = v;
    case 'settleQuietFrames':
      final v = _asPositiveInt(value);
      if (v == null) return 'settleQuietFrames must be a positive int';
      settleQuietFrames = v;
    case 'scrollMaxScrolls':
      final v = _asPositiveInt(value);
      if (v == null) return 'scrollMaxScrolls must be a positive int';
      scrollMaxScrolls = v;
    case 'scrollAmountFraction':
      final v = looseNum(value);
      if (v == null || v <= 0 || v > 1) {
        return 'scrollAmountFraction must be in (0, 1]';
      }
      scrollAmountFraction = v;
    case 'actionLogCapacity':
      final v = _asPositiveInt(value);
      if (v == null) return 'actionLogCapacity must be a positive int';
      actionLogCapacity = v;
    case 'appLogCapacity':
      final v = _asPositiveInt(value);
      if (v == null) return 'appLogCapacity must be a positive int';
      appLogCapacity = v;
    case 'iconEnrichMax':
      final v = _asPositiveInt(value);
      if (v == null) return 'iconEnrichMax must be a positive int';
      iconEnrichMax = v;
    case 'inputEnrichMax':
      final v = _asPositiveInt(value);
      if (v == null) return 'inputEnrichMax must be a positive int';
      inputEnrichMax = v;
    case 'sceneLineBudget':
      final v = _asPositiveInt(value);
      if (v == null) return 'sceneLineBudget must be a positive int';
      sceneLineBudget = v;
    case 'devHints':
      final v = looseBool(value);
      if (v == null) return 'devHints must be true or false';
      devHints = v;
    case 'captureSettleMs':
      final v = _asPositiveInt(value);
      if (v == null) return 'captureSettleMs must be a positive int';
      captureSettleMs = v;
    case 'screenshotMaxSize':
      final v = looseInt(value);
      if (v == null || v < 0) return 'screenshotMaxSize must be 0 (full size) or a positive int';
      screenshotMaxSize = v;
    case 'screenshotFormat':
      final v = value.toString().toLowerCase();
      if (v != 'jpeg' && v != 'png') return "screenshotFormat must be 'jpeg' or 'png'";
      screenshotFormat = v;
    case 'screenshotQuality':
      final v = looseInt(value);
      if (v == null || v < 1 || v > 100) return 'screenshotQuality must be 1-100';
      screenshotQuality = v;
    case 'showTouches':
      final v = looseBool(value);
      if (v == null) return 'showTouches must be true or false';
      showTouches = v;
    case 'iosNativeRunner':
      final v = looseBool(value);
      if (v == null) return 'iosNativeRunner must be true or false';
      iosNativeRunner = v;
    default:
      return 'unknown config key: $key';
  }
  return null;
}