Skip to content

Commit

Permalink
Fix file package min version (#1240)
Browse files Browse the repository at this point in the history
  • Loading branch information
marandaneto authored Jan 25, 2023
1 parent 25d647d commit c70e01a
Show file tree
Hide file tree
Showing 8 changed files with 18 additions and 14 deletions.
1 change: 0 additions & 1 deletion .github/workflows/file.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ jobs:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
# removing beta because of Dart 2.19.0
sdk: [stable]
steps:
- uses: dart-lang/setup-dart@6a218f2413a3e78e9087f638a238f6b40893203d # pin@v1
Expand Down
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Changelog

## Unreleased

### Breaking Changes:

- sentry_file now requires Dart >= 2.19 ([#1240](https://github.com/getsentry/sentry-dart/pull/1240))

## 6.18.3

### Fixes
Expand Down
8 changes: 4 additions & 4 deletions file/lib/src/sentry_file.dart
Original file line number Diff line number Diff line change
Expand Up @@ -53,17 +53,17 @@ class SentryFile implements File {
}

@override
Future<File> create({bool recursive = false}) {
Future<File> create({bool recursive = false, bool exclusive = false}) {
return _wrap(
() async => _file.create(recursive: recursive),
() async => _file.create(recursive: recursive, exclusive: exclusive),
'file.write',
);
}

@override
void createSync({bool recursive = false}) {
void createSync({bool recursive = false, bool exclusive = false}) {
return _wrapSync(
() => _file.createSync(recursive: recursive),
() => _file.createSync(recursive: recursive, exclusive: exclusive),
'file.write',
);
}
Expand Down
3 changes: 1 addition & 2 deletions file/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@ repository: https://github.com/getsentry/sentry-dart
issue_tracker: https://github.com/getsentry/sentry-dart/issues

environment:
# <2.19 because of https://github.com/dart-lang/sdk/issues/49647 breaking change
sdk: '>=2.12.0 <2.19.0'
sdk: '>=2.19.0 <3.0.0'

dependencies:
sentry: 6.18.3
Expand Down
4 changes: 4 additions & 0 deletions flutter/example/lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -330,6 +330,7 @@ class MainScaffold extends StatelessWidget {
ElevatedButton(
onPressed: () async {
final id = await Sentry.captureMessage('UserFeedback');
// ignore: use_build_context_synchronously
await showDialog(
context: context,
builder: (context) {
Expand Down Expand Up @@ -547,6 +548,7 @@ Future<void> makeWebRequest(BuildContext context) async {

await transaction.finish(status: const SpanStatus.ok());

// ignore: use_build_context_synchronously
await showDialog<void>(
context: context,
// gets tracked if using SentryNavigatorObserver
Expand Down Expand Up @@ -601,6 +603,7 @@ Future<void> makeWebRequestWithDio(BuildContext context) async {
await span.finish();
}

// ignore: use_build_context_synchronously
await showDialog<void>(
context: context,
// gets tracked if using SentryNavigatorObserver
Expand Down Expand Up @@ -633,6 +636,7 @@ Future<void> showDialogWithTextAndImage(BuildContext context) async {
);
final text =
await DefaultAssetBundle.of(context).loadString('assets/lorem-ipsum.txt');
// ignore: use_build_context_synchronously
await showDialog<void>(
context: context,
// gets tracked if using SentryNavigatorObserver
Expand Down
2 changes: 2 additions & 0 deletions flutter/example/lib/user_feedback_dialog.dart
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ class _UserFeedbackDialogState extends State<UserFeedbackDialog> {
Text(
"It looks like we're having some internal issues.",
textAlign: TextAlign.center,
// ignore: deprecated_member_use
style: Theme.of(context).textTheme.headline6,
),
const SizedBox(height: 4),
Expand All @@ -43,6 +44,7 @@ class _UserFeedbackDialogState extends State<UserFeedbackDialog> {
textAlign: TextAlign.center,
style: Theme.of(context)
.textTheme
// ignore: deprecated_member_use
.subtitle1
?.copyWith(color: Colors.grey),
),
Expand Down
5 changes: 1 addition & 4 deletions min_version_test/lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,9 @@ import 'dart:io' if (dart.library.html) 'dart:html';
import 'package:logging/logging.dart';
import 'package:dio/dio.dart';

import 'package:sentry/sentry.dart';
import 'package:sentry_flutter/sentry_flutter.dart';
import 'package:sentry_dio/sentry_dio.dart';
import 'package:sentry_logging/sentry_logging.dart';
import 'package:sentry_file/sentry_file.dart';

// ATTENTION: Change the DSN below with your own to see the events in Sentry. Get one at sentry.io
const String _exampleDsn =
Expand Down Expand Up @@ -116,9 +114,8 @@ class _MyHomePageState extends State<MyHomePage> {

try {
final file = File('response.txt');
final sentryFile = file.sentryTrace();
final response = await dio.get<String>('https://flutter.dev/');
await sentryFile.writeAsString(response.data ?? 'no response');
await file.writeAsString(response.data ?? 'no response');

await transaction.finish(status: SpanStatus.ok());
} catch (exception, stackTrace) {
Expand Down
3 changes: 0 additions & 3 deletions min_version_test/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ dependencies:
sentry_flutter:
sentry_dio:
sentry_logging:
sentry_file:
dio: ^4.0.0
logging: ^1.0.0

Expand All @@ -53,8 +52,6 @@ dependency_overrides:
path: ../dio
sentry_logging:
path: ../logging
sentry_file:
path: ../file

# For information on the generic Dart part of this file, see the
# following page: https://dart.dev/tools/pub/pubspec
Expand Down

0 comments on commit c70e01a

Please sign in to comment.