Skip to content

Commit ed46e21

Browse files
authored
flutter min version test (#966)
1 parent 6750ca1 commit ed46e21

File tree

70 files changed

+1669
-2
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

70 files changed

+1669
-2
lines changed
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
name: min version test
2+
on:
3+
push:
4+
branches:
5+
- main
6+
- release/**
7+
pull_request:
8+
defaults:
9+
run:
10+
shell: bash
11+
jobs:
12+
build:
13+
name: Build
14+
runs-on: macos-latest
15+
timeout-minutes: 30
16+
17+
steps:
18+
- uses: actions/checkout@v3
19+
20+
- uses: actions/setup-java@v3
21+
with:
22+
distribution: 'adopt'
23+
java-version: '11'
24+
25+
- uses: subosito/flutter-action@v2
26+
with:
27+
flutter-version: '2.0.0'
28+
29+
- name: Build
30+
run: |
31+
cd min_version_test
32+
flutter pub get
33+
flutter build ios --no-codesign
34+
flutter build appbundle

CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,15 @@
22

33
## Unreleased
44

5+
### Features
6+
7+
* Bump Flutter's min. supported version from 1.17.0 to 2.0.0 ([#966](https://github.com/getsentry/sentry-dart/pull/966))
8+
9+
This should not break anything since the Dart's min. version is already 2.12.0 and Flutter 2.0.0 uses Dart 2.12.0
10+
511
### Fixes
612

13+
* Back compatibility of Object.hash for Dart 2.12.0 ([#966](https://github.com/getsentry/sentry-dart/pull/966))
714
* Fix back compatibility for OnErrorIntegration integration ([#965](https://github.com/getsentry/sentry-dart/pull/965))
815

916
## 6.8.1

dart/lib/src/client_reports/client_report_recorder.dart

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import 'package:meta/meta.dart';
22

33
import '../sentry_options.dart';
4+
import '../utils/hash_code.dart';
45
import 'client_report.dart';
56
import 'discarded_event.dart';
67
import 'discard_reason.dart';
@@ -43,7 +44,7 @@ class _QuantityKey {
4344
final DataCategory category;
4445

4546
@override
46-
int get hashCode => Object.hash(reason, category);
47+
int get hashCode => hash2(reason.hashCode, category.hashCode);
4748

4849
@override
4950
bool operator ==(dynamic other) {

dart/lib/src/utils/hash_code.dart

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
// Borrowed from https://api.dart.dev/stable/2.17.6/dart-core/Object/hash.html
2+
// Since Object.hash(a, b) is only available from Dart 2.14
3+
4+
// A per-isolate seed for hash code computations.
5+
final int _hashSeed = identityHashCode(Object);
6+
7+
int _combine(int hash, int value) {
8+
hash = 0x1fffffff & (hash + value);
9+
hash = 0x1fffffff & (hash + ((0x0007ffff & hash) << 10));
10+
return hash ^ (hash >> 6);
11+
}
12+
13+
int hash2(int v1, int v2) {
14+
int hash = _hashSeed;
15+
hash = _combine(hash, v1);
16+
hash = _combine(hash, v2);
17+
return _finish(hash);
18+
}
19+
20+
int _finish(int hash) {
21+
hash = 0x1fffffff & (hash + ((0x03ffffff & hash) << 3));
22+
hash = hash ^ (hash >> 11);
23+
return 0x1fffffff & (hash + ((0x00003fff & hash) << 15));
24+
}

flutter/example/lib/main.dart

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,15 @@ import 'dart:convert';
44
import 'package:flutter/foundation.dart';
55
import 'package:flutter/material.dart';
66
import 'package:flutter/services.dart';
7+
import 'package:logging/logging.dart';
78
import 'package:sentry_flutter/sentry_flutter.dart';
89
import 'package:universal_platform/universal_platform.dart';
910
import 'package:feedback/feedback.dart' as feedback;
1011
import 'package:provider/provider.dart';
1112
import 'user_feedback_dialog.dart';
1213
import 'package:dio/dio.dart';
1314
import 'package:sentry_dio/sentry_dio.dart';
15+
import 'package:sentry_logging/sentry_logging.dart';
1416

1517
// ATTENTION: Change the DSN below with your own to see the events in Sentry. Get one at sentry.io
1618
const String _exampleDsn =
@@ -28,6 +30,7 @@ Future<void> main() async {
2830
options.considerInAppFramesByDefault = false;
2931
options.attachThreads = true;
3032
options.enableWindowMetricBreadcrumbs = true;
33+
options.addIntegration(LoggingIntegration());
3134
},
3235
// Init your App.
3336
appRunner: () => runApp(
@@ -391,6 +394,13 @@ class AndroidExample extends StatelessWidget {
391394
},
392395
child: const Text('Platform exception'),
393396
),
397+
ElevatedButton(
398+
onPressed: () {
399+
final log = Logger('Logging');
400+
log.info('My Logging test');
401+
},
402+
child: const Text('Logging'),
403+
),
394404
]);
395405
}
396406
}

flutter/example/pubspec.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,12 @@ dependencies:
1414
sentry:
1515
sentry_flutter:
1616
sentry_dio:
17+
sentry_logging:
1718
universal_platform: ^1.0.0-nullsafety
1819
feedback: ^2.0.0
1920
provider: ^6.0.0
2021
dio: ^4.0.0
22+
logging: ^1.0.2
2123

2224
dev_dependencies:
2325
pedantic: ^1.11.1
@@ -30,6 +32,8 @@ dependency_overrides:
3032
path: ../
3133
sentry_dio:
3234
path: ../../dio
35+
sentry_logging:
36+
path: ../../logging
3337

3438
flutter:
3539
uses-material-design: true

flutter/pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ issue_tracker: https://github.com/getsentry/sentry-dart/issues
77

88
environment:
99
sdk: '>=2.12.0 <3.0.0'
10-
flutter: '>=1.17.0'
10+
flutter: '>=2.0.0'
1111

1212
dependencies:
1313
flutter:

logging/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ Integration for the [`logging`](https://pub.dev/packages/logging) package.
2424

2525
```dart
2626
import 'package:sentry/sentry.dart';
27+
import 'package:sentry_logging/sentry_logging.dart';
2728
2829
Future<void> main() async {
2930
await Sentry.init(

min_version_test/.gitignore

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
# Miscellaneous
2+
*.class
3+
*.log
4+
*.pyc
5+
*.swp
6+
.DS_Store
7+
.atom/
8+
.buildlog/
9+
.history
10+
.svn/
11+
12+
# IntelliJ related
13+
*.iml
14+
*.ipr
15+
*.iws
16+
.idea/
17+
18+
# The .vscode folder contains launch configuration and tasks you configure in
19+
# VS Code which you may wish to be included in version control, so this line
20+
# is commented out by default.
21+
#.vscode/
22+
23+
# Flutter/Dart/Pub related
24+
**/doc/api/
25+
**/ios/Flutter/.last_build_id
26+
.dart_tool/
27+
.flutter-plugins
28+
.flutter-plugins-dependencies
29+
.packages
30+
.pub-cache/
31+
.pub/
32+
/build/
33+
34+
# Web related
35+
lib/generated_plugin_registrant.dart
36+
37+
# Symbolication related
38+
app.*.symbols
39+
40+
# Obfuscation related
41+
app.*.map.json
42+
43+
# Exceptions to above rules.
44+
!/packages/flutter_tools/test/data/dart_dependencies_test/**/.packages

min_version_test/.metadata

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
# This file tracks properties of this Flutter project.
2+
# Used by Flutter tool to assess capabilities and perform upgrades etc.
3+
#
4+
# This file should be version controlled.
5+
6+
version:
7+
revision: f1875d570e39de09040c8f79aa13cc56baab8db1
8+
channel: stable
9+
10+
project_type: app
11+
12+
# Tracks metadata for the flutter migrate command
13+
migration:
14+
platforms:
15+
- platform: root
16+
create_revision: f1875d570e39de09040c8f79aa13cc56baab8db1
17+
base_revision: f1875d570e39de09040c8f79aa13cc56baab8db1
18+
- platform: android
19+
create_revision: f1875d570e39de09040c8f79aa13cc56baab8db1
20+
base_revision: f1875d570e39de09040c8f79aa13cc56baab8db1
21+
- platform: ios
22+
create_revision: f1875d570e39de09040c8f79aa13cc56baab8db1
23+
base_revision: f1875d570e39de09040c8f79aa13cc56baab8db1
24+
- platform: linux
25+
create_revision: f1875d570e39de09040c8f79aa13cc56baab8db1
26+
base_revision: f1875d570e39de09040c8f79aa13cc56baab8db1
27+
- platform: macos
28+
create_revision: f1875d570e39de09040c8f79aa13cc56baab8db1
29+
base_revision: f1875d570e39de09040c8f79aa13cc56baab8db1
30+
- platform: web
31+
create_revision: f1875d570e39de09040c8f79aa13cc56baab8db1
32+
base_revision: f1875d570e39de09040c8f79aa13cc56baab8db1
33+
- platform: windows
34+
create_revision: f1875d570e39de09040c8f79aa13cc56baab8db1
35+
base_revision: f1875d570e39de09040c8f79aa13cc56baab8db1
36+
37+
# User provided section
38+
39+
# List of Local paths (relative to this file) that should be
40+
# ignored by the migrate tool.
41+
#
42+
# Files that are not part of the templates will be ignored by default.
43+
unmanaged_files:
44+
- 'lib/main.dart'
45+
- 'ios/Runner.xcodeproj/project.pbxproj'

0 commit comments

Comments
 (0)