tryGetKey method

RxResult<V> tryGetKey(
  1. K key
)

Safe key access with error handling

Implementation

RxResult<V> tryGetKey(K key) {
  return RxResult.tryExecute(() {
    final val = value[key];
    if (val == null && !value.containsKey(key)) {
      throw RxException('Key not found: $key');
    }
    return val as V;
  }, 'get map key');
}