-
-
Notifications
You must be signed in to change notification settings - Fork 14
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
❄️ Freeze #318
❄️ Freeze #318
Conversation
Keyboard & InlineKeyboard CaseThe void main(List<String> args) async {
final keyboard = Keyboard();
keyboard.text("Click Me");
keyboard.requestLocation("Send Me Location");
await api.sendMessage(
chatId,
"Use the buttons please.",
replyMarkup: keyboard,
);
} Solution1. Update the keyboard variable on each changeJust like how we use void main(List<String> args) async {
var keyboard = Keyboard();
keyboard = keyboard.text("Click Me");
keyboard = keyboard.requestLocation("Send Me Location");
await api.sendMessage(
chatId,
"Use the buttons please.",
replyMarkup: keyboard,
);
} 2. Chain it or spread it.void main(List<String> args) async {
var keyboard =
Keyboard().text("Click Me").requestLocation("Send Me Location");
await api.sendMessage(
chatId,
"Use the buttons please.",
replyMarkup: keyboard,
);
} 3. (Untested)Or may be we can do
|
The second solution LGTM! It should be the best one, as it doesn't assign the variable again and again (1) and doesn't box/unbox the object every time (3) but just uses the copyWith method :) |
Tracked in #319.