Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Accept Map<String, dynamic> in Hint class #1807

Merged
merged 18 commits into from
Jan 23, 2024
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
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
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,12 @@
- APM for isar ([#1726](https://github.com/getsentry/sentry-dart/pull/1726))
- Add isar breadcrumbs ([#1800](https://github.com/getsentry/sentry-dart/pull/1800))
- Starting with Flutter 3.16, Sentry adds the [`appFlavor`](https://api.flutter.dev/flutter/services/appFlavor-constant.html) to the `flutter_context` ([#1799](https://github.com/getsentry/sentry-dart/pull/1799))
- Accept `Map<String, dynamic>` in `Hint` class ([#1807](https://github.com/getsentry/sentry-dart/pull/1807))
denrase marked this conversation as resolved.
Show resolved Hide resolved
- Please check if everything works as expected when using `Hint`
- Factory constructor `Hint.withMap(Map<String, dynamic> map)` now takes `Map<String, dynamic>` instead of `Map<String, Object>`
- Method `hint.addAll(Map<String, dynamic> keysAndValues)` now takes `Map<String, dynamic>` instead of `Map<String, Object>`
- Method `set(String key, dynamic value)` now takes value of `dynamic` instead of `Object`
- Method `hint.get(String key)` now returns `dynamic` instead of `Object?`
- Add beforeScreenshotCallback to SentryFlutterOptions ([#1805](https://github.com/getsentry/sentry-dart/pull/1805))

### Dependencies
Expand Down
12 changes: 6 additions & 6 deletions dart/lib/src/hint.dart
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ import 'sentry_attachment/sentry_attachment.dart';
/// };
/// ```
class Hint {
final Map<String, Object> _internalStorage = {};
final Map<String, dynamic> _internalStorage = {};

final List<SentryAttachment> attachments = [];

Expand All @@ -62,7 +62,7 @@ class Hint {
return hint;
}

factory Hint.withMap(Map<String, Object> map) {
factory Hint.withMap(Map<String, dynamic> map) {
final hint = Hint();
hint.addAll(map);
return hint;
Expand All @@ -80,17 +80,17 @@ class Hint {
return hint;
}

// Objects
// Key/Value Storage

void addAll(Map<String, Object> keysAndValues) {
void addAll(Map<String, dynamic> keysAndValues) {
_internalStorage.addAll(keysAndValues);
}

void set(String key, Object value) {
void set(String key, dynamic value) {
_internalStorage[key] = value;
}

Object? get(String key) {
dynamic get(String key) {
return _internalStorage[key];
}

Expand Down
6 changes: 6 additions & 0 deletions sqflite/lib/src/sentry_database.dart
Original file line number Diff line number Diff line change
Expand Up @@ -196,4 +196,10 @@
}
});
}

@override

Check warning on line 200 in sqflite/lib/src/sentry_database.dart

View check run for this annotation

Codecov / codecov/patch

sqflite/lib/src/sentry_database.dart#L200

Added line #L200 was not covered by tests
Future<T> readTransaction<T>(Future<T> Function(Transaction txn) action) {
// TODO: Add sentry span/crumb
return _database.readTransaction(action);

Check warning on line 203 in sqflite/lib/src/sentry_database.dart

View check run for this annotation

Codecov / codecov/patch

sqflite/lib/src/sentry_database.dart#L203

Added line #L203 was not covered by tests
}
}
6 changes: 3 additions & 3 deletions sqflite/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ environment:

dependencies:
sentry: 7.14.0
sqflite: ^2.0.0
sqflite_common: ^2.0.0
sqflite: ^2.3.0
sqflite_common: ^2.3.0
denrase marked this conversation as resolved.
Show resolved Hide resolved
meta: ^1.3.0
path: ^1.8.3

Expand All @@ -24,4 +24,4 @@ dev_dependencies:
mockito: ^5.1.0
build_runner: ^2.4.2
yaml: ^3.1.0 # needed for version match (code and pubspec)
sqflite_common_ffi: ^2.0.0
sqflite_common_ffi: ^2.3.0
denrase marked this conversation as resolved.
Show resolved Hide resolved
Loading