from property

User? get from

The user who sent the message or performed the action.

This tries to extract the user from various update types and returns null if no user information is available. The result is cached after the first access for better performance.

Implementation

User? get from {
  if (!_fromCached) {
    _cachedFrom =
        callbackQuery?.from ??
        inlineQuery?.from ??
        chosenInlineResult?.from ??
        shippingQuery?.from ??
        preCheckoutQuery?.from ??
        msg?.from;
    _fromCached = true;
  }
  return _cachedFrom;
}