TelegramWebAppFake class

Inheritance

Constructors

TelegramWebAppFake()

Properties

backButton BackButton
An object for controlling the back button which can be displayed in the header of the Mini App in the Telegram interface.
no setteroverride
backgroundColor Color?
Current background color in the #RRGGBB format.
no setteroverride
biometricManager BiometricManager
An object for controlling biometrics on the device.
no setteroverride
bottomBarColor Color?
Current bottom bar color in the #RRGGBB format.
no setteroverride
cloudStorage CloudStorage
An object for controlling cloud storage.
no setteroverride
colorScheme TelegramColorScheme
The color scheme currently used in the Telegram app. Either “light” or “dark”. Also available as the CSS variable var(--tg-color-scheme).
no setteroverride
hapticFeedback HapticFeedback
An object for controlling haptic feedback.
no setteroverride
hashCode int
The hash code for this object.
no setterinherited
headerColor Color?
Current header color in the #RRGGBB format.
no setteroverride
initData TelegramInitData
A string with raw data transferred to the Mini App, convenient for validating data. WARNING: Validate data from this field before using it on the bot's server.
no setteroverride
initDataUnsafe WebAppInitData?
An object with input data transferred to the Mini App. WARNING: Data from this field should not be trusted. You should only use data from initData on the bot's server and only after it has been validated.
no setteroverride
isClosingConfirmationEnabled bool
True, if the confirmation dialog is enabled while the user is trying to close the Mini App. False, if the confirmation dialog is disabled.
no setteroverride
isExpanded bool
True, if the Mini App is expanded to the maximum available height. False, if the Mini App occupies part of the screen and can be expanded to the full height using the expand() method.
no setteroverride
isSupported bool
Returns true if opened inside Telegram web.
no setteroverride
isVerticalSwipesEnabled bool
True, if vertical swipes to close or minimize the Mini App are enabled. False, if vertical swipes to close or minimize the Mini App are disabled. In any case, the user will still be able to minimize and close the Mini App by swiping the Mini App's header.
no setteroverride
mainButton BottomButton
An object for controlling the main button, which is displayed at the bottom of the Mini App in the Telegram interface.
no setteroverride
platform String
The name of the platform of the user's Telegram app.
no setteroverride
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
secondaryButton BottomButton
An object for controlling the secondary button, which is displayed at the bottom of the Mini App in the Telegram interface.
no setteroverride
settingButton SettingsButton
An object for controlling the Settings item in the context menu of the Mini App in the Telegram interface.
no setteroverride
themeParams ThemeParams
An object containing the current theme settings used in the Telegram app.
no setteroverride
version String
The version of the Bot API available in the user's Telegram app.
no setteroverride
viewportHeight double?
The current height of the visible area of the Mini App. Also available in CSS as the variable var(--tg-viewport- height).
no setteroverride
viewportStableHeight double?
The height of the visible area of the Mini App in its last stable state. Also available in CSS as a variable var(--tg- viewport-stable-height).
no setteroverride

Methods

close() → void
A method that closes the Mini App.
override
closeScanQrPopup() → void
Bot API 6.4+ A method that closes the native popup for scanning a QR code opened with the showScanQrPopup method. Run it if you received valid data in the event qrTextReceived.
override
disableClosingConfirmation() → void
Bot API 6.2+ A method that disables the confirmation dialog while the user is trying to close the Mini App.
override
disableVerticalSwipes() → void
Bot API 7.7+ A method that disables vertical swipes to close or minimize the Mini App. This method is useful if your Mini App uses swipe gestures that may conflict with the gestures for minimizing and closing the app.
override
enableClosingConfirmation() → void
Bot API 6.2+ A method that enables a confirmation dialog while the user is trying to close the Mini App.
override
enableVerticalSwipes() → void
Bot API 7.7+ A method that enables vertical swipes to close or minimize the Mini App. For user convenience, it is recommended to always enable swipes unless they conflict with the Mini App's own gestures.
override
expand() → void
A method that expands the Mini App to the maximum available height. To find out if the Mini App is expanded to the maximum height, refer to the value of the Telegram.WebApp.isExpanded parameter
override
isVersionAtLeast(String version) bool
Returns true if the user's app supports a version of the Bot API that is equal to or higher than the version passed as the parameter.
override
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
offEvent(TelegramEvent event) → void
A method that deletes a previously set event handler.
override
onEvent(TelegramEvent event) → void
A method that sets the app event handler. Check the list of available events.
override
openInvoice(String url, [void onInvoiceStatus(InvoiceStatus status)?]) → void
Bot API 6.1+ A method that opens an invoice using the link url. The Mini App will receive the event invoiceClosed when the invoice is closed. If an optional callback parameter was passed, the callback function will be called and the invoice status will be passed as the first argument.
override
A method that opens a link in an external browser. The Mini App will not be closed. Bot API 6.4+ If the optional options parameter is passed with the field try_instant_view=true, the link will be opened in Instant View mode if possible.
override
A method that opens a telegram link inside the Telegram app. The Mini App will not be closed after this method is called.
override
readTextFromClipboard([void onRead(String clipboardText)?]) → void
Bot API 6.4+ A method that requests text from the clipboard. The Mini App will receive the event clipboardTextReceived. If an optional callback parameter was passed, the callback function will be called and the text from the clipboard will be passed as the first argument.
override
ready() → void
A method that informs the Telegram app that the Mini App is ready to be displayed. It is recommended to call this method as early as possible, as soon as all essential interface elements are loaded. Once this method is called, the loading placeholder is hidden and the Mini App is shown. If the method is not called, the placeholder will be hidden only when the page is fully loaded.
override
requestContact([void onResult(bool granted)?]) → void
Bot API 6.9+ A method that shows a native popup prompting the user for their phone number. If an optional callback parameter was passed, the callback function will be called when the popup is closed and the first argument will be a boolean indicating whether the user shared its phone number.
override
requestWriteAccess({required dynamic onResult(bool granted)}) → void
Bot API 6.9+ A method that shows a native popup requesting permission for the bot to send messages to the user. If an optional callback parameter was passed, the callback function will be called when the popup is closed and the first argument will be a boolean indicating whether the user granted this access.
override
sendData(String data) → void
A method used to send data to the bot. When this method is called, a service message is sent to the bot containing the data data of the length up to 4096 bytes, and the Mini App is closed. See the field web_app_data in the class Message.
override
setBackgroundColor(Color color) → void
Bot API 6.1+ A method that sets the app background color in the #RRGGBB format. You can also use keywords bg_color and secondary_bg_color.
override
setBottomBarColor(Color color) → void
Bot API 7.10+ A method that sets the app's bottom bar color in the #RRGGBB format. You can also use the keywords bg_color, secondary_bg_color and bottom_bar_bg_color.
override
setHeaderColor(Color color) → void
Bot API 6.1+ A method that sets the app header color in the #RRGGBB format. You can also use keywords bg_color and secondary_bg_color.
override
shareToStory(String mediaUrl, {StoryShareParams? params}) → void
Bot API 7.8+ A method that opens the native story editor with the media specified in the media_url parameter as an HTTPS URL. An optional params argument of the type StoryShareParams describes additional sharing settings.
override
showAlert(String message, [dynamic callback()?]) → void
Bot API 6.2+ A method that shows message in a simple alert with a 'Close' button. If an optional callback parameter was passed, the callback function will be called when the popup is closed.
override
showConfirm(String message, [void callback(bool isOkPressed)?]) → void
Bot API 6.2+ A method that shows message in a simple confirmation window with 'OK' and 'Cancel' buttons. If an optional callback parameter was passed, the callback function will be called when the popup is closed and the first argument will be a boolean indicating whether the user pressed the 'OK' button.
override
showPopup({String? title, required String message, List<PopupButton>? buttons, required dynamic callback(String id)}) → void
Bot API 6.2+ A method that shows a native popup described by the params argument of the type PopupParams. The Mini App will receive the event popupClosed when the popup is closed. If an optional callback parameter was passed, the callback function will be called and the field id of the pressed button will be passed as the first argument.
override
showScanQrPopup(String? infoTitle, [bool callback(String result)?]) → void
Bot API 6.4+ A method that shows a native popup for scanning a QR code described by the params argument of the type ScanQrPopupParams. The Mini App will receive the event qrTextReceived every time the scanner catches a code with text data. If an optional callback parameter was passed, the callback function will be called and the text from the QR code will be passed as the first argument. Returning true inside this callback function causes the popup to be closed. Starting from Bot API 7.7, the Mini App will receive the scanQrPopupClosed event if the user closes the native popup for scanning a QR code.
override
switchInlineQuery(String query, [List<ChatType>? chatTypes]) → void
Bot API 6.7+ A method that inserts the bot's username and the specified inline query in the current chat's input field. Query may be empty, in which case only the bot's username will be inserted. If an optional choose_chat_types parameter was passed, the client prompts the user to choose a specific chat, then opens that chat and inserts the bot's username and the specified inline query in the input field. You can specify which types of chats the user will be able to choose from. It can be one or more of the following types: users, bots, groups, channels.
override
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited