sendLocation method

Future<Message> sendLocation(
  1. dynamic chat_id,
  2. double latitude,
  3. double longitude, {
  4. double? horizontal_accuracy,
  5. int? live_period,
  6. int? heading,
  7. int? proximity_alert_radius,
  8. bool? disable_notification,
  9. int? reply_to_message_id,
  10. bool? allow_sending_without_reply,
  11. ReplyMarkup? reply_markup,
})
inherited

Use this method to send point on the map

On success, the sent Message is returned.

https://core.telegram.org/bots/api#sendlocation

Implementation

Future<Message> sendLocation(
    dynamic chat_id, double latitude, double longitude,
    {double? horizontal_accuracy,
    int? live_period,
    int? heading,
    int? proximity_alert_radius,
    bool? disable_notification,
    int? reply_to_message_id,
    bool? allow_sending_without_reply,
    ReplyMarkup? reply_markup}) async {
  if (chat_id is! String && chat_id is! int) {
    return Future.error(TelegramException(
        'Attribute \'chat_id\' can only be either type of String or int'));
  }
  var requestUrl = _apiUri('sendLocation');
  var body = <String, dynamic>{
    'chat_id': chat_id,
    'latitude': latitude,
    'longitude': longitude,
    'horizontal_accuracy': horizontal_accuracy,
    'live_period': live_period,
    'heading': heading,
    'proximity_alert_radius': proximity_alert_radius,
    'disable_notification': disable_notification,
    'reply_to_message_id': reply_to_message_id,
    'allow_sending_without_reply': allow_sending_without_reply,
    'reply_markup': reply_markup == null ? null : jsonEncode(reply_markup),
  };
  return Message.fromJson(await HttpClient.httpPost(requestUrl, body: body));
}