TelegramNotifier constructor

TelegramNotifier({
  1. required String botToken,
  2. required String defaultChatId,
  3. Dio? dio,
  4. MessageFormatter? formatter,
})

Creates a service for sending notifications to Telegram.

  • botToken: Your Telegram Bot API token.
  • defaultChatId: The chat ID or channel/username where messages will be sent by default.
  • dio: (Optional) Your custom Dio client. If not provided, a default one will be created.
  • formatter: (Optional) Your custom message formatting strategy. If not provided, DefaultJsonFormatter will be used.

Implementation

TelegramNotifier({
  required String botToken,
  required String defaultChatId,
  Dio? dio,
  MessageFormatter? formatter,
}) : _botToken = botToken,
     _defaultChatId = defaultChatId,
     _dio = dio ?? Dio(),
     _formatter = formatter ?? const DefaultJsonFormatter();