When an exception is thrown and unhandled in a TextField.onChanged
handler it doesn't bubble up to the global Flutter.onError
handler so it's silently missed. Is there a way to globally handle these errors so that I'm at least aware that they're thrown when developing?
It appears to be caught and converted into an object in MethodChannel._handleAsMethodCall()
, but I don't understand how it's handled from there.
main() {
runApp(Test());
}
class Test extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
home: Scaffold(
body: Center(
child: TextField(
decoration: InputDecoration(
labelText: "Input",
),
onChanged: (input) {
throw Exception(); // <-------- swallowed by framework
},
),
),
),
);
}
}