canAccess static method

bool canAccess({
  1. String? userId,
})

Returns true if the logger should be accessible for the current user. Checks debug mode or allowedIds (to be used in UI logic). If allowedIds is empty, no one is allowed by ID.

Implementation

static bool canAccess({String? userId}) {
  if (!_initialized) {
    return false;
  }
  final cfg = config.value;
  if (cfg.enableInDebug) {
    return true;
  }
  if (cfg.allowedIds.isEmpty) {
    return false;
  }
  if (userId != null && cfg.allowedIds.contains(userId)) {
    return true;
  }
  return false;
}