callbackButton method
Allows without sending a message from the user to receive a notification of a button click and perform the necessary action
builder.callbackButton(
label: 'Buy a coffee',
payload: {
"command": "buy",
"item": "coffee"
}
);
Implementation
KeyboardBuilder callbackButton(
{required String label,
_Button payload = const {},
Color color = Color.SECONDARY}) {
if (label.length > 40) {
throw RangeError('Maximum length of label 40 characters');
}
return _addButton({
'color': _colors[color.index],
'action': {
'label': label,
'payload': _serializePayload(payload),
'type': 'callback'
}
});
}