79195283

Date: 2024-11-16 14:00:42
Score: 0.5
Natty:
Report link

You are right that both mechanisms handle Dart errors but there is difference is here :

Its used for catch errors occurring within the UI and Flutter's own error boundaries, like it Handles uncaught synchronous errors originating in the Flutter framework, and The FlutterErrorDetails object provides context specific to Flutter (e.g., widget library issues).

Its used catch all unhandled asynchronous errors, even if they are not related to Flutter (like some exceptions from other plugin or dependencies), also any isolate's event loop, not just the UI thread, so It’s like "global safety net" for any uncaught errors across your app, whether it come from UI tasks or background operations.

Non of above method is directly not able to handles errors thrown from native Java or Swift code, to catch those, you'd need to use platform-specific mechanisms (like uncaughtExceptionHandler in Android or NSSetUncaughtExceptionHandler in iOS) or something like that as per your exact requirement and pass them to Dart using platform channels approach will be recomended.

Reasons:
  • Long answer (-1):
  • No code block (0.5):
  • Low reputation (1):
Posted by: Rmakant Tiwari