diff --git a/.github/workflows/flutter.yml b/.github/workflows/flutter.yml index 9ed21fa6f2..e26124ed99 100644 --- a/.github/workflows/flutter.yml +++ b/.github/workflows/flutter.yml @@ -200,6 +200,6 @@ jobs: steps: - uses: actions/checkout@v4 # To recreate baseline run: detekt -i flutter/android,flutter/example/android -b flutter/config/detekt-bl.xml -cb - - uses: natiginfo/action-detekt-all@e01de6ff0eef7c24131e8a133bf598cfac6ceeab # pin@1.21.0 + - uses: natiginfo/action-detekt-all@be3c18799c7c392b2f41a674beed9ced7ae2f21b # pin@1.23.1 with: args: -i flutter/android,flutter/example/android --baseline flutter/config/detekt-bl.xml --jvm-target 1.8 --build-upon-default-config --all-rules diff --git a/flutter/example/android/app/src/main/kotlin/io/sentry/samples/flutter/MainActivity.kt b/flutter/example/android/app/src/main/kotlin/io/sentry/samples/flutter/MainActivity.kt index 14f222d254..7966a33655 100644 --- a/flutter/example/android/app/src/main/kotlin/io/sentry/samples/flutter/MainActivity.kt +++ b/flutter/example/android/app/src/main/kotlin/io/sentry/samples/flutter/MainActivity.kt @@ -11,37 +11,33 @@ class MainActivity : FlutterActivity() { override fun configureFlutterEngine(flutterEngine: FlutterEngine) { super.configureFlutterEngine(flutterEngine) - MethodChannel(flutterEngine.dartExecutor.binaryMessenger, _channel).setMethodCallHandler { - call, result -> + MethodChannel( + flutterEngine.dartExecutor.binaryMessenger, + _channel, + ).setMethodCallHandler { call, result -> // Note: this method is invoked on the main thread. when (call.method) { - "throw" -> { + "throw" -> thread(isDaemon = true) { throw Exception("Catch this java exception thrown from Kotlin thread!") } - } - "anr" -> { - Thread.sleep(6_000) - } - "capture" -> { + + "anr" -> Thread.sleep(6_000) + + "capture" -> try { throw RuntimeException("Catch this java exception!") } catch (e: Exception) { Sentry.captureException(e) } - } - "crash" -> { - crash() - } - "cpp_capture_message" -> { - message() - } - "platform_exception" -> { - throw RuntimeException("Catch this platform exception!") - } - else -> { - result.notImplemented() - } + + "crash" -> crash() + + "cpp_capture_message" -> message() + + "platform_exception" -> throw RuntimeException("Catch this platform exception!") + + else -> result.notImplemented() } result.success("") }