jhomlala / catcher

Flutter error catching & handling plugin. Handles and reports exceptions in your app!
Apache License 2.0
784 stars 175 forks source link

Use PlatformDispatcher.onError instead of custom zone starting with Flutter 3.3 #232

Open HosamHasanRamadan opened 1 year ago

HosamHasanRamadan commented 1 year ago

Starting with Flutter 3.3, apps should now use PlatformDispatcher.onError instead of running the app in a custom zone to catch errors. I believe catcher is using a custom zone to catch errors.

Release notes: https://medium.com/flutter/whats-new-in-flutter-3-3-893c7b9af1ff#:~:text=In%20this%20release%2C%20instead%20of%20using%20a%20custom%20Zone%2C%20you%20should%20catch%20all%20errors%20and%20exceptions%20by%20setting%20the%20PlatformDispatcher.onError%20callback.

The error handling page was also updated to reflect these changes: https://docs.flutter.dev/testing/errors

calcitem commented 1 year ago

We can use

https://github.com/calcitem/Sanmill/commit/9de1aff2e4218875b46f083a1a5766c37d836bc3

PlatformDispatcher.instance.onError = (error, stack) {

        Catcher.reportCheckedError(error, stack);

      return true;
    };