I tried using Catcher, here is my code

CatcherOptions debugOptions = CatcherOptions(SilentReportMode(), [
    ConsoleHandler(),
    HttpHandler(HttpRequestType.post,
      Uri.parse("https://api.telegram.org/bot<TOKEN>/sendMessage?chat_id=-469322015&text="),
      printLogs: true,
    ),

  ]);

  Catcher(MyApp(), debugConfig: debugOptions, releaseConfig: releaseOptions);

Everything is fine, but I must enter the error message into this parameter /sendMessage?chat_id=-469322015&text="Here Error Message"

Please help me how to do that


Solution 1: Miko

SOLVED by create own ReportMode 🙏🏻

class SilentReportMode extends ReportMode {
  @override
  void requestAction(Report report, BuildContext context) {
    // no action needed, request is automatically accepted
    print("HEREEEEE ======= ${report.error}");
    try {
      sendError(report);
    } catch (e) {
    }
    super.onActionConfirmed(report);
  }

  Future sendError(Report report) async {
    try {
      Response response = await Dio().post('https://api.telegram.org/bot<TOKEN>/sendMessage?chat_id=-469322015&text=message: $report',
      );

      print("RESPONSE TELEGErammmmm ====== ${response.data}");
    } catch (e) {
      throw e;
    }
  }

  @override
  List<PlatformType> getSupportedPlatforms() =>
      [PlatformType.Web, PlatformType.Android, PlatformType.iOS];
}