Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
92 commits
Select commit Hold shift + click to select a range
03f8118
Update
buenaflor Sep 2, 2025
6928f3a
Update
buenaflor Sep 3, 2025
a91cbae
Update
buenaflor Sep 3, 2025
a6bd3cc
Update
buenaflor Sep 3, 2025
b9269c7
Update
buenaflor Sep 3, 2025
6ef9960
Update
buenaflor Sep 4, 2025
a43f2e1
Configure diagnostic log
buenaflor Sep 4, 2025
e334269
Update log messages
buenaflor Sep 4, 2025
aa728e7
Update
buenaflor Sep 4, 2025
45cc8c3
Update
buenaflor Sep 4, 2025
a603960
Update
buenaflor Sep 4, 2025
147da01
Update
buenaflor Sep 4, 2025
2b11149
Update
buenaflor Sep 4, 2025
8325952
Update
buenaflor Sep 4, 2025
3dbe751
Update
buenaflor Sep 4, 2025
71ba593
Update
buenaflor Sep 4, 2025
fe7f6df
Update
buenaflor Sep 4, 2025
39a951e
Update
buenaflor Oct 7, 2025
884642f
Fix test
buenaflor Oct 7, 2025
f5f5401
Update
buenaflor Oct 7, 2025
de232c6
Update
buenaflor Oct 7, 2025
69d5111
Update
buenaflor Oct 7, 2025
79d9ff9
Merge branch 'main' into enh/long-lived-envelope-worker
buenaflor Oct 7, 2025
62bb12b
Add automatedTestMode option
buenaflor Oct 7, 2025
532d2b3
Merge branch 'main' into enh/long-lived-envelope-worker
buenaflor Oct 7, 2025
53c6036
Update
buenaflor Oct 7, 2025
06ee227
Fix web tests
buenaflor Oct 7, 2025
10d9419
Update
buenaflor Oct 7, 2025
e6771bb
Update
buenaflor Oct 7, 2025
e2ae6a3
Add close
buenaflor Oct 7, 2025
ae9b24c
Review
buenaflor Oct 8, 2025
7efb747
Merge branch 'main' into enh/long-lived-envelope-worker
buenaflor Oct 8, 2025
4b440d0
Review
buenaflor Oct 8, 2025
91b0298
Update
buenaflor Oct 8, 2025
2cd6dd8
Update
buenaflor Oct 8, 2025
2f1840d
Update
buenaflor Oct 8, 2025
7750213
Update
buenaflor Oct 9, 2025
cd554e4
Update
buenaflor Oct 9, 2025
9708168
Update
buenaflor Oct 9, 2025
99b5584
Update
buenaflor Oct 9, 2025
eead0ce
Update
buenaflor Oct 9, 2025
780a59c
Update
buenaflor Oct 9, 2025
143414f
Update
buenaflor Oct 9, 2025
60f9674
Update
buenaflor Oct 9, 2025
3eeda60
Fix tests
buenaflor Oct 9, 2025
a40112f
Update
buenaflor Oct 9, 2025
83f8ea4
Update
buenaflor Oct 9, 2025
f9edebc
Update
buenaflor Oct 9, 2025
c40ff0c
Update
buenaflor Oct 9, 2025
e80304a
Merge branch 'enh/app-start-refresh-rate-jni-ffi' into enh/app-hang-f…
buenaflor Oct 9, 2025
d4641f9
Breadcrumb support
buenaflor Oct 9, 2025
0cfd7ba
Update
buenaflor Oct 13, 2025
5ad708c
Update
buenaflor Oct 13, 2025
d5857e8
Update
buenaflor Oct 13, 2025
e6f2a73
Merge branch 'enh/app-hang-ffi-jni-refactor' into enh/ffi-jni-breadcr…
buenaflor Oct 13, 2025
21155c0
Update
buenaflor Oct 13, 2025
054c6ff
Fix unit tests
buenaflor Oct 13, 2025
895068c
Merge branch 'main' into enh/app-start-refresh-rate-jni-ffi
buenaflor Oct 13, 2025
bfb5259
Update
buenaflor Oct 13, 2025
a2fda2c
Update
buenaflor Oct 14, 2025
1ffba6f
Update
buenaflor Oct 14, 2025
f881241
Merge branch 'enh/app-start-refresh-rate-jni-ffi' into enh/app-hang-f…
buenaflor Oct 14, 2025
9733bc8
Merge branch 'main' into enh/app-start-refresh-rate-jni-ffi
buenaflor Oct 14, 2025
3af23cc
Update
buenaflor Oct 16, 2025
7538a1c
Update
buenaflor Oct 16, 2025
a72956d
Merge branch 'enh/app-hang-ffi-jni-refactor' into enh/ffi-jni-breadcr…
buenaflor Oct 16, 2025
fce96c7
Update
buenaflor Oct 16, 2025
958fa0d
Update
buenaflor Oct 16, 2025
84542ab
Update
buenaflor Oct 16, 2025
e744a5e
Update
buenaflor Oct 16, 2025
9912628
Update
buenaflor Oct 16, 2025
dee9256
Update
buenaflor Oct 16, 2025
ab2f4e9
Update
buenaflor Oct 16, 2025
ed51094
Update
buenaflor Oct 16, 2025
0d378b3
Update
buenaflor Oct 16, 2025
5abe802
Merge branch 'enh/app-start-refresh-rate-jni-ffi' into enh/app-hang-f…
buenaflor Oct 16, 2025
d4a7e17
Merge branch 'enh/app-hang-ffi-jni-refactor' into enh/ffi-jni-breadcr…
buenaflor Oct 17, 2025
d5641dc
Update
buenaflor Oct 17, 2025
8eb5153
Update
buenaflor Oct 17, 2025
6bcf81b
Update
buenaflor Oct 17, 2025
5cc9c78
Update
buenaflor Oct 17, 2025
aacf1ff
Update
buenaflor Oct 20, 2025
3a25e45
Merge branch 'enh/app-hang-ffi-jni-refactor' into enh/ffi-jni-breadcr…
buenaflor Oct 20, 2025
714279e
Update
buenaflor Oct 20, 2025
0ed0935
Merge branch 'enh/app-hang-ffi-jni-refactor' into enh/ffi-jni-breadcr…
buenaflor Oct 20, 2025
b82a031
Update
buenaflor Oct 20, 2025
f8616ed
Merge branch 'main' into enh/ffi-jni-breadcrumbs-sync
buenaflor Oct 23, 2025
1e52e9f
Update
buenaflor Oct 23, 2025
a95a359
Update
buenaflor Oct 23, 2025
0a10098
Fix analyze
buenaflor Oct 23, 2025
ca1fed5
Remove comment
buenaflor Oct 23, 2025
3729c2b
Update formatting
buenaflor Oct 23, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@

### Enhancements

- Refactor native breadcrumbs sync to use FFI/JNI ([#3293](https://github.com/getsentry/sentry-dart/pull/3293/))
- Refactor app hang and crash apis to use FFI/JNI ([#3289](https://github.com/getsentry/sentry-dart/pull/3289/))
- Refactor `AndroidReplayRecorder` to use the new worker isolate api ([#3296](https://github.com/getsentry/sentry-dart/pull/3296/))
- Refactor fetching app start and display refresh rate to use FFI and JNI ([#3288](https://github.com/getsentry/sentry-dart/pull/3288/))
Expand Down
4 changes: 2 additions & 2 deletions packages/dart/lib/src/scope_observer.dart
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ abstract class ScopeObserver {
Future<void> setContexts(String key, dynamic value);
Future<void> removeContexts(String key);
Future<void> setUser(SentryUser? user);
Future<void> addBreadcrumb(Breadcrumb breadcrumb);
Future<void> clearBreadcrumbs();
FutureOr<void> addBreadcrumb(Breadcrumb breadcrumb);
FutureOr<void> clearBreadcrumbs();
Future<void> setExtra(String key, dynamic value);
Future<void> removeExtra(String key);
Future<void> setTag(String key, String value);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,6 @@ class SentryFlutterPlugin :
"setContexts" -> setContexts(call.argument("key"), call.argument("value"), result)
"removeContexts" -> removeContexts(call.argument("key"), result)
"setUser" -> setUser(call.argument("user"), result)
"addBreadcrumb" -> addBreadcrumb(call.argument("breadcrumb"), result)
"clearBreadcrumbs" -> clearBreadcrumbs(result)
"setExtra" -> setExtra(call.argument("key"), call.argument("value"), result)
"removeExtra" -> removeExtra(call.argument("key"), result)
"setTag" -> setTag(call.argument("key"), call.argument("value"), result)
Expand Down Expand Up @@ -189,24 +187,6 @@ class SentryFlutterPlugin :
result.success("")
}

private fun addBreadcrumb(
breadcrumb: Map<String, Any?>?,
result: Result,
) {
if (breadcrumb != null) {
val options = ScopesAdapter.getInstance().options
val breadcrumbInstance = Breadcrumb.fromMap(breadcrumb, options)
Sentry.addBreadcrumb(breadcrumbInstance)
}
result.success("")
}

private fun clearBreadcrumbs(result: Result) {
Sentry.clearBreadcrumbs()

result.success("")
}

private fun setExtra(
key: String?,
value: String?,
Expand Down
45 changes: 45 additions & 0 deletions packages/flutter/example/integration_test/integration_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -564,6 +564,51 @@ void main() {
}
});

testWidgets('addBreadcrumb and clearBreadcrumbs sync to native',
(tester) async {
await restoreFlutterOnErrorAfter(() async {
await setupSentryAndApp(tester);
});

// 1. Add a breadcrumb via Dart
final testBreadcrumb = Breadcrumb(
message: 'test-breadcrumb-message',
category: 'test-category',
level: SentryLevel.info,
);
await Sentry.addBreadcrumb(testBreadcrumb);

// 2. Verify it appears in native via loadContexts
var contexts = await SentryFlutter.native?.loadContexts();
expect(contexts, isNotNull);

var breadcrumbs = contexts!['breadcrumbs'] as List<dynamic>?;
expect(breadcrumbs, isNotNull,
reason: 'Breadcrumbs should not be null after adding');
expect(breadcrumbs!.isNotEmpty, isTrue,
reason: 'Breadcrumbs should not be empty after adding');

// Find our test breadcrumb
final testCrumb = breadcrumbs.firstWhere(
(b) => b['message'] == 'test-breadcrumb-message',
orElse: () => null,
);
expect(testCrumb, isNotNull,
reason: 'Test breadcrumb should exist in native breadcrumbs');
expect(testCrumb['category'], equals('test-category'));

// 3. Clear breadcrumbs
await Sentry.configureScope((scope) async {
await scope.clearBreadcrumbs();
});

// 4. Verify they're cleared in native
contexts = await SentryFlutter.native?.loadContexts();
breadcrumbs = contexts!['breadcrumbs'] as List<dynamic>?;
expect(breadcrumbs == null || breadcrumbs.isEmpty, isTrue,
reason: 'Breadcrumbs should be null or empty after clearing');
});

testWidgets('loads debug images through loadDebugImages', (tester) async {
await restoreFlutterOnErrorAfter(() async {
await setupSentryAndApp(tester);
Expand Down
7 changes: 7 additions & 0 deletions packages/flutter/ffi-cocoa.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ headers:
entry-points:
- ./temp/Sentry.framework/PrivateHeaders/PrivateSentrySDKOnly.h
- ./temp/Sentry.framework/Headers/Sentry-Swift.h
- ./temp/Sentry.framework/Headers/SentryScope.h
- ./ios/sentry_flutter/Sources/sentry_flutter_objc/SentryFlutterPlugin.h
compiler-opts:
- -DSENTRY_TARGET_PROFILING_SUPPORTED=1
Expand All @@ -19,6 +20,7 @@ objc-interfaces:
- PrivateSentrySDKOnly
- SentryId
- SentryFlutterPlugin
- SentryScope
- SentrySDK
module:
'SentryId': 'Sentry'
Expand All @@ -29,6 +31,11 @@ objc-interfaces:
- 'crash'
- 'pauseAppHangTracking'
- 'resumeAppHangTracking'
- 'configureScope:'
- 'addBreadcrumb:'
SentryScope:
include:
- 'clearBreadcrumbs'
preamble: |
// ignore_for_file: type=lint, unused_element

3 changes: 3 additions & 0 deletions packages/flutter/ffi-jni.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,7 @@ classes:
- io.sentry.android.core.InternalSentrySdk
- io.sentry.android.replay.ReplayIntegration
- io.sentry.flutter.SentryFlutterPlugin
- io.sentry.Sentry
- io.sentry.Breadcrumb
- io.sentry.ScopesAdapter
- android.graphics.Bitmap
Original file line number Diff line number Diff line change
Expand Up @@ -92,14 +92,6 @@ public class SentryFlutterPlugin: NSObject, FlutterPlugin {
let user = arguments?["user"] as? [String: Any]
setUser(user: user, result: result)

case "addBreadcrumb":
let arguments = call.arguments as? [String: Any?]
let breadcrumb = arguments?["breadcrumb"] as? [String: Any]
addBreadcrumb(breadcrumb: breadcrumb, result: result)

case "clearBreadcrumbs":
clearBreadcrumbs(result: result)

case "setExtra":
let arguments = call.arguments as? [String: Any?]
let key = arguments?["key"] as? String
Expand Down Expand Up @@ -322,22 +314,6 @@ public class SentryFlutterPlugin: NSObject, FlutterPlugin {
result("")
}

private func addBreadcrumb(breadcrumb: [String: Any]?, result: @escaping FlutterResult) {
if let breadcrumb = breadcrumb {
let breadcrumbInstance = PrivateSentrySDKOnly.breadcrumb(with: breadcrumb)
SentrySDK.addBreadcrumb(breadcrumbInstance)
}
result("")
}

private func clearBreadcrumbs(result: @escaping FlutterResult) {
SentrySDK.configureScope { scope in
scope.clearBreadcrumbs()

result("")
}
}

private func setExtra(key: String?, value: Any?, result: @escaping FlutterResult) {
guard let key = key else {
result("")
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
// Copyright (c) 2025, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.

// We need to add this file until we update the objective_c package due to a bug
// See the issue: https://github.com/dart-lang/native/pull/2581

#ifndef OBJECTIVE_C_SRC_NS_NUMBER_H_
#define OBJECTIVE_C_SRC_NS_NUMBER_H_

#import <Foundation/Foundation.h>

@interface NSNumber (NSNumberIsFloat)
@property (readonly) bool isFloat;
@end

#endif // OBJECTIVE_C_SRC_NS_NUMBER_H_
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
// Copyright (c) 2025, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.

// We need to add this file until we update the objective_c package due to a bug
// See the issue: https://github.com/dart-lang/native/pull/2581

#import "ns_number.h"

@implementation NSNumber (NSNumberIsFloat)
-(bool)isFloat {
const char *t = [self objCType];
return strcmp(t, @encode(float)) == 0 || strcmp(t, @encode(double)) == 0;
}
@end
Loading
Loading