#Flutter SDK behavior on errors from appRunner within Sentry.init
7 messages · Page 1 of 1 (latest)
hey, could you share your init setup? do you do any processing before SentryFlutter.init?
There's nothing before SentryFlutter.init, everything happens inside appRunner. An async method failed in this case. The main method looks like this:
Future<void> main() async {
WidgetsFlutterBinding.ensureInitialized();
await SentryFlutter.init(
configureSentry,
appRunner: () async {
final transaction = Sentry.startTransaction(
'app_startup',
'task',
bindToScope: true,
);
try {
await _startApp(span: transaction);
} finally {
await transaction.finish();
}
},
);
}
Note: in _startApp, it didn't make it to any runApp(). It failed in-between.
I just tried to repro this and it successfully manages to report the unhandled exception (tested on Android & Web)
by the time appRunner is executed the SDK is ready to catch and report events.
I think I need more info here, which platform are you targeting?
await SentryFlutter.init(
(options) {
options.dsn = exampleDsn;
},
appRunner: () async {
throw Exception('test');
runApp(
// ...
);
},
);