requestWriteAccess abstract method
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.
Implementation
void requestWriteAccess({required Function(bool granted) onResult});