Skip to content

Commit 1300280

Browse files
feat: decrease Dart SDK minimum from 2.17 to 2.14 (#34)
Apps with Flutter 2.x are using Dart 2.14, like [Sharezone](https://github.com/SharezoneApp/sharezone-app). There was no real to use Dart 2.17. So we can just decrease the minimum.
1 parent 8996c22 commit 1300280

File tree

15 files changed

+80
-74
lines changed

15 files changed

+80
-74
lines changed

.github/workflows/pull_request.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@ name: pull-request-ci
33
on:
44
pull_request:
55

6+
env:
7+
FLUTTER_VERSION: 2.5.0 # Uses Dart SDK v2.14.0
8+
69
jobs:
710
test:
811
runs-on: ubuntu-latest
@@ -11,7 +14,6 @@ jobs:
1114
- uses: subosito/flutter-action@v1
1215
with:
1316
flutter-version: ${{ env.FLUTTER_VERSION }}
14-
channel: ${{ env.FLUTTER_CHANNEL }}
1517

1618
- name: Install Melos
1719
run: dart pub global activate melos
@@ -29,7 +31,6 @@ jobs:
2931
- uses: subosito/flutter-action@v1
3032
with:
3133
flutter-version: ${{ env.FLUTTER_VERSION }}
32-
channel: ${{ env.FLUTTER_CHANNEL }}
3334

3435
- name: Install Melos
3536
run: dart pub global activate melos
@@ -47,7 +48,6 @@ jobs:
4748
- uses: subosito/flutter-action@v1
4849
with:
4950
flutter-version: ${{ env.FLUTTER_VERSION }}
50-
channel: ${{ env.FLUTTER_CHANNEL }}
5151

5252
- name: Install Melos
5353
run: dart pub global activate melos

packages/app_preview_example/lib/main.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ void main() {
55
}
66

77
class MyApp extends StatelessWidget {
8-
const MyApp({super.key});
8+
const MyApp({Key? key}) : super(key: key);
99

1010
@override
1111
Widget build(BuildContext context) {
@@ -20,7 +20,7 @@ class MyApp extends StatelessWidget {
2020
}
2121

2222
class MyHomePage extends StatefulWidget {
23-
const MyHomePage({super.key, required this.title});
23+
const MyHomePage({Key? key, required this.title}) : super(key: key);
2424

2525
final String title;
2626

packages/app_preview_example/pubspec.lock

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ packages:
1414
name: async
1515
url: "https://pub.dartlang.org"
1616
source: hosted
17-
version: "2.8.2"
17+
version: "2.8.1"
1818
boolean_selector:
1919
dependency: transitive
2020
description:
@@ -28,7 +28,7 @@ packages:
2828
name: characters
2929
url: "https://pub.dartlang.org"
3030
source: hosted
31-
version: "1.2.0"
31+
version: "1.1.0"
3232
charcode:
3333
dependency: transitive
3434
description:
@@ -49,14 +49,14 @@ packages:
4949
name: collection
5050
url: "https://pub.dartlang.org"
5151
source: hosted
52-
version: "1.16.0"
52+
version: "1.15.0"
5353
fake_async:
5454
dependency: transitive
5555
description:
5656
name: fake_async
5757
url: "https://pub.dartlang.org"
5858
source: hosted
59-
version: "1.3.0"
59+
version: "1.2.0"
6060
flutter:
6161
dependency: "direct main"
6262
description: flutter
@@ -73,21 +73,14 @@ packages:
7373
name: lints
7474
url: "https://pub.dartlang.org"
7575
source: hosted
76-
version: "2.0.0"
76+
version: "1.0.1"
7777
matcher:
7878
dependency: transitive
7979
description:
8080
name: matcher
8181
url: "https://pub.dartlang.org"
8282
source: hosted
83-
version: "0.12.11"
84-
material_color_utilities:
85-
dependency: transitive
86-
description:
87-
name: material_color_utilities
88-
url: "https://pub.dartlang.org"
89-
source: hosted
90-
version: "0.1.4"
83+
version: "0.12.10"
9184
meta:
9285
dependency: transitive
9386
description:
@@ -101,7 +94,7 @@ packages:
10194
name: path
10295
url: "https://pub.dartlang.org"
10396
source: hosted
104-
version: "1.8.1"
97+
version: "1.8.0"
10598
sky_engine:
10699
dependency: transitive
107100
description: flutter
@@ -113,7 +106,7 @@ packages:
113106
name: source_span
114107
url: "https://pub.dartlang.org"
115108
source: hosted
116-
version: "1.8.2"
109+
version: "1.8.1"
117110
stack_trace:
118111
dependency: transitive
119112
description:
@@ -148,13 +141,20 @@ packages:
148141
name: test_api
149142
url: "https://pub.dartlang.org"
150143
source: hosted
151-
version: "0.4.9"
144+
version: "0.4.2"
145+
typed_data:
146+
dependency: transitive
147+
description:
148+
name: typed_data
149+
url: "https://pub.dartlang.org"
150+
source: hosted
151+
version: "1.3.0"
152152
vector_math:
153153
dependency: transitive
154154
description:
155155
name: vector_math
156156
url: "https://pub.dartlang.org"
157157
source: hosted
158-
version: "2.1.2"
158+
version: "2.1.0"
159159
sdks:
160-
dart: ">=2.17.5 <3.0.0"
160+
dart: ">=2.14.0 <3.0.0"

packages/app_preview_example/pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ publish_to: 'none'
44
version: 1.0.0+1
55

66
environment:
7-
sdk: ">=2.17.5 <3.0.0"
7+
sdk: ">=2.14.0 <3.0.0"
88

99
dependencies:
1010
flutter:

packages/app_preview_lints/lib/analysis_options.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,3 @@ linter:
88
# The following lints are for a consistent code style.
99
- sort_constructors_first
1010
- prefer_single_quotes
11-
- use_super_parameters

packages/app_preview_lints/pubspec.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ name: app_preview_lints
22
description: Set of lint rules for for the app preview CLI.
33

44
environment:
5-
sdk: ">=2.17.0 <3.0.0"
5+
sdk: ">=2.14.0 <3.0.0"
66

77
dependencies:
8-
lints: ^2.0.0
8+
lints: ^1.0.1

packages/codemagic_app_preview/lib/src/builds/build.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ class Build {
2828
factory Build.fromJson(Map<String, dynamic> json) {
2929
return Build(
3030
url: json['url'],
31-
platform: BuildPlatform.fromType(json['type']),
31+
platform: getBuildPlatform(json['type']),
3232
);
3333
}
3434

packages/codemagic_app_preview/lib/src/builds/build_platform.dart

Lines changed: 23 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -8,28 +8,34 @@ enum BuildPlatform {
88
/// The build is for the iOS platform.
99
///
1010
/// File formats are `.ipa`.
11-
ios;
12-
13-
factory BuildPlatform.fromType(String type) {
14-
switch (type) {
15-
// todo: is this really aab or something else?
16-
case 'aab':
17-
case 'apk':
18-
return android;
19-
case 'ipa':
20-
return ios;
21-
default:
22-
throw Exception('Unknown build platform type: $type');
23-
}
24-
}
11+
ios,
12+
}
2513

14+
/// Extension methods for [BuildPlatform].
15+
///
16+
/// When using Dart 2.17 as minimum version, should this be refactored to enum
17+
/// class, like: https://github.com/nilsreichardt/codemagic-app-preview/blob/8996c2219af619acfb0a37df83e83041202653e4/packages/codemagic_app_preview/lib/src/builds/build_platform.dart
18+
extension BuildPlatformExtension on BuildPlatform {
2619
/// Returns the name of the platform, e.g. "iOS" for [ios].
27-
String get name {
20+
String get platformName {
2821
switch (this) {
29-
case android:
22+
case BuildPlatform.android:
3023
return 'Android';
31-
case ios:
24+
case BuildPlatform.ios:
3225
return 'iOS';
3326
}
3427
}
3528
}
29+
30+
/// Returns the [BuildPlatform] for the given [fileExtension].
31+
BuildPlatform getBuildPlatform(String fileExtension) {
32+
switch (fileExtension) {
33+
case 'aab':
34+
case 'apk':
35+
return BuildPlatform.android;
36+
case 'ipa':
37+
return BuildPlatform.ios;
38+
default:
39+
throw Exception('Unknown build platform file extension: $fileExtension');
40+
}
41+
}

packages/codemagic_app_preview/lib/src/comment/comment_builder.dart

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import 'package:codemagic_app_preview/src/builds/build.dart';
2+
import 'package:codemagic_app_preview/src/builds/build_platform.dart';
23
import 'package:codemagic_app_preview/src/environment_variable/environment_variable_accessor.dart';
34

45
class CommentBuilder {
@@ -50,7 +51,7 @@ class CommentBuilder {
5051

5152
table.write('|');
5253
for (final build in builds) {
53-
table.write(' ${build.platform.name} |');
54+
table.write(' ${build.platform.platformName} |');
5455
}
5556

5657
table.write('\n|');

packages/codemagic_app_preview/lib/src/comment/comment_poster.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ class CommentPoster {
2020
final shouldEdit = previousComment != null;
2121

2222
if (shouldEdit) {
23-
await _gitHubApi.editComment(previousComment.id, comment);
23+
await _gitHubApi.editComment(previousComment!.id, comment);
2424
} else {
2525
await _gitHubApi.postComment(pullRequestId, comment);
2626
}

0 commit comments

Comments
 (0)