Raw Invoke
Part of the API Reference. The escape hatch for any MTProto method ptgc doesn’t have a typed wrapper for yet — with the same DC-migration and error-handling logic every namespace method already gets.
When to reach for this
ptgc wraps a useful, common subset of Telegram’s schema. For anything it doesn’t wrap yet, import package:ptgc/raw.dart alongside the normal entrypoint:
import 'package:ptgc/ptgc.dart';
import 'package:ptgc/raw.dart' as t;
final result = await client.invoke(t.UsersGetFullUser(id: someInputUser));
package:ptgc/raw.dart is a separate entrypoint (rather than being folded into package:ptgc/ptgc.dart) so that everyday ptgc usage doesn’t pull the entire generated schema — thousands of types — into scope; only import it when you actually need the escape hatch.
TelegramClient.invoke
Future<t.TlObject> invoke(t.TlMethod method) {
Invokes any raw t.TlMethod and returns its raw t.TlObject result. This is a thin wrapper over [TelegramClient.raw]/callRaw — prefer this over touching raw directly unless you specifically need raw’s per-namespace grouping (.channels, .messages, …).
TelegramClient.raw
tg.Client get raw {
The underlying generated tg.Client, with every raw MTProto method grouped by namespace (raw.channels.updatePinnedMessage(...), raw.messages.getHistory(...), and so on) — often more discoverable than building a t.TlMethod by hand for invoke. See Raw Invoke: Pinning a Message and Raw Invoke: Message History.
Peer resolution for raw calls
Most raw methods take an InputPeerBase, InputUserBase, or InputChannelBase rather than a plain ID. Build these from Peer Cache rather than constructing them yourself:
final peer = client.peerCache.inputPeer(chatId);
await client.invoke(t.MessagesGetHistory(peer: peer, /* ... */));