parse static method

DeviceTierConfig parse(
  1. Object? json
)

The config, or defaults when json is missing or malformed anywhere: a bad value falls back whole, never half-applies, and never throws. An operator this SDK does not know is kept and evaluates false, so a newer rule never matches on an older SDK. Port of Android DeviceTierConfig.parse.

Implementation

static DeviceTierConfig parse(Object? json) {
  if (json is! Map) return defaults;
  try {
    return _parseOrNull(json) ?? defaults;
  } catch (_) {
    return defaults;
  }
}