TelegramBotCrashlytics class

A utility class to send error and informational messages to Telegram and Slack. Integrates with Dio to automatically intercept HTTP errors.

Key Features:

  • Send error and informational messages to Telegram.
  • Optionally send error messages to Slack.
  • Include HTTP headers and ignore specific status codes.
  • Integrate with Dio as an interceptor.

Constructors

TelegramBotCrashlytics({required String botToken, required int chatId, String? slackWebhookUrl, List<int>? ignoreStatusCodes, bool? includeHeaders})
Factory constructor for creating or accessing the singleton instance.
factory

Properties

botToken String
Telegram Bot Token: The token of the bot that will send the error messages.
final
chatId int
Telegram Chat ID: The ID of the chat where the error messages will be sent.
final
hashCode int
The hash code for this object.
no setterinherited
ignoreStatusCodes List<int>
HTTP status codes to ignore when sending error messages.
final
includeHeaders bool
Whether to include HTTP headers in the error messages.
final
interceptor → Interceptor
Provides the interceptor for Dio integration.
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
slackWebhookUrl String?
Slack Webhook URL: The URL to send messages to Slack.
final

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
sendErrorToBoth(String errorMessage) Future<void>
Sends an error message to both Telegram and Slack.
sendErrorToSlack(String errorMessage) Future<void>
Sends an error message to Slack.
sendErrorToTelegram(String errorMessage) Future<void>
Sends an error message to Telegram.
sendInfoToTelegram(String message) Future<void>
Sends an informational message to Telegram.
toString() String
A string representation of this object.
inherited

Operators

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

Static Properties

instance TelegramBotCrashlytics
Access the singleton instance of TelegramBotCrashlytics.
no setter