lookup<T> static method

T? lookup<T>(
  1. String key
)

Synchronous lookup. Returns null if activate hasn't been called or the key has no value AND no default. Used internally by UniTrack's getRemoteValue resolver chain.

Implementation

static T? lookup<T>(String key) {
  final rc = _rc;
  if (rc == null) return null;
  final v = rc.getValue(key);
  switch (T) {
    case String:
      final s = v.asString();
      return s.isEmpty ? null : s as T;
    case bool:
      return v.asBool() as T;
    case int:
      return v.asInt() as T;
    case double:
      return v.asDouble() as T;
    default:
      return null;
  }
}