-
-
Notifications
You must be signed in to change notification settings - Fork 271
Description
Platform:
- Dart
- Flutter Android or iOS
- Flutter Web
IDE:
- VSCode
- IntelliJ/AS
- XCode
- Other, which one?
split-debug-info and obfuscate (Flutter Android or iOS) or CanvasKit (Flutter Web):
- Enabled
- Disabled
Platform installed with:
- pub.dev
- GitHub
Output of the command flutter doctor -v
below:
[✓] Flutter (Channel stable, 3.3.10, on macOS 13.1 22C65 darwin-x64, locale en-GB)
• Flutter version 3.3.10 on channel stable at /Users/barabas/source/flutter
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision 135454af32 (7 weeks ago), 2022-12-15 07:36:55 -0800
• Engine revision 3316dd8728
• Dart version 2.18.6
• DevTools version 2.15.0
[!] Android toolchain - develop for Android devices (Android SDK version 33.0.1)
• Android SDK at /Users/barabas/Library/Android/sdk
✗ cmdline-tools component is missing
Run `path/to/sdkmanager --install "cmdline-tools;latest"`
See https://developer.android.com/studio/command-line for more details.
✗ Android license status unknown.
Run `flutter doctor --android-licenses` to accept the SDK licenses.
See https://flutter.dev/docs/get-started/install/macos#android-setup for more details.
[✓] Xcode - develop for iOS and macOS (Xcode 14.2)
• Xcode at /Applications/Xcode.app/Contents/Developer
• Build 14C18
• CocoaPods version 1.11.3
[!] Android Studio (version 2022.1)
• Android Studio at /Applications/Android Studio.app/Contents
• Flutter plugin can be installed from:
🔨 https://plugins.jetbrains.com/plugin/9212-flutter
• Dart plugin can be installed from:
🔨 https://plugins.jetbrains.com/plugin/6351-dart
✗ Unable to find bundled Java version.
• Try updating or re-installing Android Studio.
[✓] VS Code (version 1.74.3)
• VS Code at /Users/barabas/Downloads/Visual Studio Code.app/Contents
• Flutter extension can be installed from:
🔨 https://marketplace.visualstudio.com/items?itemName=Dart-Code.flutter
[✓] Connected device (2 available)
• bbb (2) (mobile) • 00008020-001458C81A01002E • ios • iOS 16.0 20A362
• macOS (desktop) • macos • darwin-x64 • macOS 13.1 22C65 darwin-x64
[✓] HTTP Host Availability
• All required HTTP hosts are available
! Doctor found issues in 2 categories.
The version of the SDK (See pubspec.lock):
6.19.0
I have the following issue:
Adding Sentry to the app causes uncaught errors to stop being reported from the Flutter engine.
Specifically we have async functions that are called from onTapped callback of Flutter widgets. When these throw, the following log is printed when the app does not use Sentry:
[VERBOSE-2:dart_vm_initializer.cc(41)] Unhandled Exception: Instance of 'Error'
#0 MyHomePage._throwAsyncError.<anonymous closure> (package:flutter_error_handling/main.dart:36:60)
#1 new Future.delayed.<anonymous closure> (dart:async/future.dart:424:39)
#2 Timer._createTimer.<anonymous closure> (dart:async-patch/timer_patch.dart:18:15)
#3 _Timer._runTimers (dart:isolate-patch/timer_impl.dart:398:19)
#4 _Timer._handleMessage (dart:isolate-patch/timer_impl.dart:429:5)
#5 _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:192:12)
This comes from the engine code here: https://github.com/flutter/engine/blob/e64b0f0a34831e094bc8c6a73c9540ab682390b3/runtime/dart_vm_initializer.cc#L41
Steps to reproduce:
- Run the demo application
- Tap on the floating action button
- Wait a second and notice the logs
- Repeat with
kUseSentry
set to true
Actual result:
No log is printed for uncaught exceptions from async callbacks called from Flutter while using Sentry.
Expected result:
A log is printed for all uncaught exceptions.
Demo app code:
import 'package:flutter/material.dart';
import 'package:sentry_flutter/sentry_flutter.dart';
const bool kUseSentry = false;
Future<void> main() async {
if (kUseSentry) {
await SentryFlutter.init(
(options) => options.dsn = const String.fromEnvironment('SENTRY_DSN'),
appRunner: () => runApp(const MyApp()),
);
} else {
runApp(const MyApp());
}
}
class MyApp extends StatelessWidget {
const MyApp({super.key});
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Flutter Demo',
theme: ThemeData(),
home: const MyHomePage(title: 'Flutter Demo Home Page'),
);
}
}
class MyHomePage extends StatelessWidget {
const MyHomePage({super.key, required this.title});
final String title;
Future<void> _throwAsyncError() async {
await Future.delayed(const Duration(seconds: 1), () => throw Error());
}
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text(title),
),
body: const SizedBox.shrink(),
floatingActionButton: FloatingActionButton(
onPressed: _throwAsyncError,
tooltip: 'Asynchronous error',
child: const Icon(Icons.bug_report),
),
);
}
}