Skip to content

Commit b7beaf8

Browse files
committed
Unit testing for fixing errors
1 parent 641e74b commit b7beaf8

File tree

11 files changed

+469
-104
lines changed

11 files changed

+469
-104
lines changed

.github/workflows/lint.yml

+3-3
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ jobs:
1313
- uses: actions/checkout@v3
1414
- uses: subosito/flutter-action@v2
1515
with:
16-
flutter-version: "3.10.3"
16+
flutter-version: "3.16.0"
1717
channel: "stable"
1818
- uses: bluefireteam/melos-action@v2
1919
- run: melos run analyze
@@ -24,7 +24,7 @@ jobs:
2424
- uses: actions/checkout@v3
2525
- uses: subosito/flutter-action@v2
2626
with:
27-
flutter-version: "3.10.3"
27+
flutter-version: "3.16.0"
2828
channel: "stable"
2929
cache: true
3030
- uses: bluefireteam/melos-action@v2
@@ -36,7 +36,7 @@ jobs:
3636
- uses: actions/checkout@v3
3737
- uses: subosito/flutter-action@v2
3838
with:
39-
flutter-version: "3.10.3"
39+
flutter-version: "3.16.0"
4040
channel: "stable"
4141
cache: true
4242
- uses: bluefireteam/melos-action@v2

.github/workflows/test.yml

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
name: test
2+
3+
on:
4+
push:
5+
branches: [main]
6+
pull_request:
7+
branches: [main]
8+
9+
jobs:
10+
test:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- uses: actions/checkout@v3
14+
- uses: subosito/flutter-action@v2
15+
with:
16+
flutter-version: "3.16.0"
17+
channel: "stable"
18+
cache: true
19+
- uses: bluefireteam/melos-action@v2
20+
- run: melos run test --no-select

examples/custom_binary_name/pubspec.lock

+31-7
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,22 @@ packages:
7575
description: flutter
7676
source: sdk
7777
version: "0.0.0"
78+
leak_tracker:
79+
dependency: transitive
80+
description:
81+
name: leak_tracker
82+
sha256: "04be76c4a4bb50f14904e64749237e541e7c7bcf7ec0b196907322ab5d2fc739"
83+
url: "https://pub.dev"
84+
source: hosted
85+
version: "9.0.16"
86+
leak_tracker_testing:
87+
dependency: transitive
88+
description:
89+
name: leak_tracker_testing
90+
sha256: b06739349ec2477e943055aea30172c5c7000225f79dad4702e2ec0eda79a6ff
91+
url: "https://pub.dev"
92+
source: hosted
93+
version: "1.0.5"
7894
lints:
7995
dependency: transitive
8096
description:
@@ -95,18 +111,18 @@ packages:
95111
dependency: transitive
96112
description:
97113
name: material_color_utilities
98-
sha256: "9528f2f296073ff54cb9fee677df673ace1218163c3bc7628093e7eed5203d41"
114+
sha256: "0e0a020085b65b6083975e499759762399b4475f766c21668c4ecca34ea74e5a"
99115
url: "https://pub.dev"
100116
source: hosted
101-
version: "0.5.0"
117+
version: "0.8.0"
102118
meta:
103119
dependency: transitive
104120
description:
105121
name: meta
106-
sha256: "3c74dbf8763d36539f114c799d8a2d87343b5067e9d796ca22b5eb8437090ee3"
122+
sha256: d584fa6707a52763a52446f02cc621b077888fb63b93bbcb1143a7be5a0c0c04
107123
url: "https://pub.dev"
108124
source: hosted
109-
version: "1.9.1"
125+
version: "1.11.0"
110126
path:
111127
dependency: transitive
112128
description:
@@ -176,13 +192,21 @@ packages:
176192
url: "https://pub.dev"
177193
source: hosted
178194
version: "2.1.4"
195+
vm_service:
196+
dependency: transitive
197+
description:
198+
name: vm_service
199+
sha256: b3d56ff4341b8f182b96aceb2fa20e3dcb336b9f867bc0eafc0de10f1048e957
200+
url: "https://pub.dev"
201+
source: hosted
202+
version: "13.0.0"
179203
web:
180204
dependency: transitive
181205
description:
182206
name: web
183-
sha256: dc8ccd225a2005c1be616fe02951e2e342092edf968cf0844220383757ef8f10
207+
sha256: edc8a9573dd8c5a83a183dae1af2b6fd4131377404706ca4e5420474784906fa
184208
url: "https://pub.dev"
185209
source: hosted
186-
version: "0.1.4-beta"
210+
version: "0.4.0"
187211
sdks:
188-
dart: ">=3.1.0-185.0.dev <4.0.0"
212+
dart: ">=3.2.0-194.0.dev <4.0.0"

examples/hello_world/lib/main.dart

+67
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,15 @@ class MyApp extends StatelessWidget {
1313
return MaterialApp(
1414
title: 'Flutter Demo',
1515
theme: ThemeData(
16+
// This is the theme of your application.
17+
//
18+
// Try running your application with "flutter run". You'll see the
19+
// application has a blue toolbar. Then, without quitting the app, try
20+
// changing the primarySwatch below to Colors.green and then invoke
21+
// "hot reload" (press "r" in the console where you ran "flutter run",
22+
// or simply save your changes to "hot reload" in a Flutter IDE).
23+
// Notice that the counter didn't reset back to zero; the application
24+
// is not restarted.
1625
primarySwatch: Colors.blue,
1726
),
1827
home: const MyHomePage(title: 'Flutter Demo Home Page'),
@@ -23,13 +32,24 @@ class MyApp extends StatelessWidget {
2332
class MyHomePage extends StatefulWidget {
2433
const MyHomePage({Key? key, required this.title}) : super(key: key);
2534

35+
// This widget is the home page of your application. It is stateful, meaning
36+
// that it has a State object (defined below) that contains fields that affect
37+
// how it looks.
38+
39+
// This class is the configuration for the state. It holds the values (in this
40+
// case the title) provided by the parent (in this case the App widget) and
41+
// used by the build method of the State. Fields in a Widget subclass are
42+
// always marked "final".
43+
2644
final String title;
2745

2846
@override
2947
State<MyHomePage> createState() => _MyHomePageState();
3048
}
3149

3250
class _MyHomePageState extends State<MyHomePage> {
51+
int _counter = 0;
52+
3353
String get _buildName {
3454
return const String.fromEnvironment('FLUTTER_BUILD_NAME');
3555
}
@@ -38,16 +58,58 @@ class _MyHomePageState extends State<MyHomePage> {
3858
return const String.fromEnvironment('FLUTTER_BUILD_NUMBER');
3959
}
4060

61+
void _incrementCounter() {
62+
setState(() {
63+
// This call to setState tells the Flutter framework that something has
64+
// changed in this State, which causes it to rerun the build method below
65+
// so that the display can reflect the updated values. If we changed
66+
// _counter without calling setState(), then the build method would not be
67+
// called again, and so nothing would appear to happen.
68+
_counter++;
69+
});
70+
}
71+
4172
@override
4273
Widget build(BuildContext context) {
74+
// This method is rerun every time setState is called, for instance as done
75+
// by the _incrementCounter method above.
76+
//
77+
// The Flutter framework has been optimized to make rerunning build methods
78+
// fast, so that you can just rebuild anything that needs updating rather
79+
// than having to individually change instances of widgets.
4380
return Scaffold(
4481
appBar: AppBar(
82+
// Here we take the value from the MyHomePage object that was created by
83+
// the App.build method, and use it to set our appbar title.
4584
title: Text(widget.title),
4685
),
4786
body: Center(
87+
// Center is a layout widget. It takes a single child and positions it
88+
// in the middle of the parent.
4889
child: Column(
90+
// Column is also a layout widget. It takes a list of children and
91+
// arranges them vertically. By default, it sizes itself to fit its
92+
// children horizontally, and tries to be as tall as its parent.
93+
//
94+
// Invoke "debug painting" (press "p" in the console, choose the
95+
// "Toggle Debug Paint" action from the Flutter Inspector in Android
96+
// Studio, or the "Toggle Debug Paint" command in Visual Studio Code)
97+
// to see the wireframe for each widget.
98+
//
99+
// Column has various properties to control how it sizes itself and
100+
// how it positions its children. Here we use mainAxisAlignment to
101+
// center the children vertically; the main axis here is the vertical
102+
// axis because Columns are vertical (the cross axis would be
103+
// horizontal).
49104
mainAxisAlignment: MainAxisAlignment.center,
50105
children: <Widget>[
106+
const Text(
107+
'You have pushed the button this many times:',
108+
),
109+
Text(
110+
'$_counter',
111+
style: Theme.of(context).textTheme.headlineMedium,
112+
),
51113
Text(
52114
'FLUTTER_BUILD_NAME: $_buildName',
53115
style: Theme.of(context).textTheme.bodyMedium,
@@ -59,6 +121,11 @@ class _MyHomePageState extends State<MyHomePage> {
59121
],
60122
),
61123
),
124+
floatingActionButton: FloatingActionButton(
125+
onPressed: _incrementCounter,
126+
tooltip: 'Increment',
127+
child: const Icon(Icons.add),
128+
), // This trailing comma makes auto-formatting nicer for build methods.
62129
);
63130
}
64131
}

examples/hello_world/pubspec.lock

+31-7
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,22 @@ packages:
7575
description: flutter
7676
source: sdk
7777
version: "0.0.0"
78+
leak_tracker:
79+
dependency: transitive
80+
description:
81+
name: leak_tracker
82+
sha256: "04be76c4a4bb50f14904e64749237e541e7c7bcf7ec0b196907322ab5d2fc739"
83+
url: "https://pub.dev"
84+
source: hosted
85+
version: "9.0.16"
86+
leak_tracker_testing:
87+
dependency: transitive
88+
description:
89+
name: leak_tracker_testing
90+
sha256: b06739349ec2477e943055aea30172c5c7000225f79dad4702e2ec0eda79a6ff
91+
url: "https://pub.dev"
92+
source: hosted
93+
version: "1.0.5"
7894
lints:
7995
dependency: transitive
8096
description:
@@ -95,18 +111,18 @@ packages:
95111
dependency: transitive
96112
description:
97113
name: material_color_utilities
98-
sha256: "9528f2f296073ff54cb9fee677df673ace1218163c3bc7628093e7eed5203d41"
114+
sha256: "0e0a020085b65b6083975e499759762399b4475f766c21668c4ecca34ea74e5a"
99115
url: "https://pub.dev"
100116
source: hosted
101-
version: "0.5.0"
117+
version: "0.8.0"
102118
meta:
103119
dependency: transitive
104120
description:
105121
name: meta
106-
sha256: "3c74dbf8763d36539f114c799d8a2d87343b5067e9d796ca22b5eb8437090ee3"
122+
sha256: d584fa6707a52763a52446f02cc621b077888fb63b93bbcb1143a7be5a0c0c04
107123
url: "https://pub.dev"
108124
source: hosted
109-
version: "1.9.1"
125+
version: "1.11.0"
110126
path:
111127
dependency: transitive
112128
description:
@@ -176,13 +192,21 @@ packages:
176192
url: "https://pub.dev"
177193
source: hosted
178194
version: "2.1.4"
195+
vm_service:
196+
dependency: transitive
197+
description:
198+
name: vm_service
199+
sha256: b3d56ff4341b8f182b96aceb2fa20e3dcb336b9f867bc0eafc0de10f1048e957
200+
url: "https://pub.dev"
201+
source: hosted
202+
version: "13.0.0"
179203
web:
180204
dependency: transitive
181205
description:
182206
name: web
183-
sha256: dc8ccd225a2005c1be616fe02951e2e342092edf968cf0844220383757ef8f10
207+
sha256: edc8a9573dd8c5a83a183dae1af2b6fd4131377404706ca4e5420474784906fa
184208
url: "https://pub.dev"
185209
source: hosted
186-
version: "0.1.4-beta"
210+
version: "0.4.0"
187211
sdks:
188-
dart: ">=3.1.0-185.0.dev <4.0.0"
212+
dart: ">=3.2.0-194.0.dev <4.0.0"

examples/multiple_flavors/pubspec.lock

+31-7
Original file line numberDiff line numberDiff line change
@@ -184,6 +184,22 @@ packages:
184184
url: "https://pub.dev"
185185
source: hosted
186186
version: "4.8.1"
187+
leak_tracker:
188+
dependency: transitive
189+
description:
190+
name: leak_tracker
191+
sha256: "04be76c4a4bb50f14904e64749237e541e7c7bcf7ec0b196907322ab5d2fc739"
192+
url: "https://pub.dev"
193+
source: hosted
194+
version: "9.0.16"
195+
leak_tracker_testing:
196+
dependency: transitive
197+
description:
198+
name: leak_tracker_testing
199+
sha256: b06739349ec2477e943055aea30172c5c7000225f79dad4702e2ec0eda79a6ff
200+
url: "https://pub.dev"
201+
source: hosted
202+
version: "1.0.5"
187203
lints:
188204
dependency: transitive
189205
description:
@@ -204,18 +220,18 @@ packages:
204220
dependency: transitive
205221
description:
206222
name: material_color_utilities
207-
sha256: "9528f2f296073ff54cb9fee677df673ace1218163c3bc7628093e7eed5203d41"
223+
sha256: "0e0a020085b65b6083975e499759762399b4475f766c21668c4ecca34ea74e5a"
208224
url: "https://pub.dev"
209225
source: hosted
210-
version: "0.5.0"
226+
version: "0.8.0"
211227
meta:
212228
dependency: transitive
213229
description:
214230
name: meta
215-
sha256: "3c74dbf8763d36539f114c799d8a2d87343b5067e9d796ca22b5eb8437090ee3"
231+
sha256: d584fa6707a52763a52446f02cc621b077888fb63b93bbcb1143a7be5a0c0c04
216232
url: "https://pub.dev"
217233
source: hosted
218-
version: "1.9.1"
234+
version: "1.11.0"
219235
package_info_plus:
220236
dependency: "direct main"
221237
description:
@@ -341,14 +357,22 @@ packages:
341357
url: "https://pub.dev"
342358
source: hosted
343359
version: "2.1.4"
360+
vm_service:
361+
dependency: transitive
362+
description:
363+
name: vm_service
364+
sha256: b3d56ff4341b8f182b96aceb2fa20e3dcb336b9f867bc0eafc0de10f1048e957
365+
url: "https://pub.dev"
366+
source: hosted
367+
version: "13.0.0"
344368
web:
345369
dependency: transitive
346370
description:
347371
name: web
348-
sha256: dc8ccd225a2005c1be616fe02951e2e342092edf968cf0844220383757ef8f10
372+
sha256: edc8a9573dd8c5a83a183dae1af2b6fd4131377404706ca4e5420474784906fa
349373
url: "https://pub.dev"
350374
source: hosted
351-
version: "0.1.4-beta"
375+
version: "0.4.0"
352376
win32:
353377
dependency: transitive
354378
description:
@@ -374,5 +398,5 @@ packages:
374398
source: hosted
375399
version: "3.1.2"
376400
sdks:
377-
dart: ">=3.1.0-185.0.dev <4.0.0"
401+
dart: ">=3.2.0-194.0.dev <4.0.0"
378402
flutter: ">=3.3.0"

0 commit comments

Comments
 (0)