Skip to content

Commit 87b42f9

Browse files
Analysis_options, format and fixups. (#103)
1 parent 52d85c7 commit 87b42f9

File tree

7 files changed

+63
-28
lines changed

7 files changed

+63
-28
lines changed

isolate_example/analysis_options.yaml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
include: package:pedantic/analysis_options.yaml
2+
3+
analyzer:
4+
strong-mode:
5+
implicit-casts: false
6+
implicit-dynamic: false
7+
8+
linter:
9+
rules:
10+
- avoid_types_on_closure_parameters
11+
- avoid_void_async
12+
- await_only_futures
13+
- camel_case_types
14+
- cancel_subscriptions
15+
- close_sinks
16+
- constant_identifier_names
17+
- control_flow_in_finally
18+
- empty_statements
19+
- hash_and_equals
20+
- implementation_imports
21+
- non_constant_identifier_names
22+
- package_api_docs
23+
- package_names
24+
- package_prefixed_library_names
25+
- test_types_in_equals
26+
- throw_in_finally
27+
- unnecessary_brace_in_string_interps
28+
- unnecessary_getters_setters
29+
- unnecessary_new
30+
- unnecessary_statements

isolate_example/lib/main.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ import 'page_one.dart';
1818
import 'page_two.dart';
1919
import 'page_three.dart';
2020

21-
void main() => runApp(new MaterialApp(home: new StartApp()));
21+
void main() => runApp(MaterialApp(home: StartApp()));
2222

2323
class StartApp extends StatelessWidget {
2424
@override

isolate_example/lib/page_one.dart

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ class _PerformancePageState extends State<PerformancePage> {
3737
children: [
3838
FutureBuilder<void>(
3939
future: computeFuture,
40-
builder: (BuildContext context, AsyncSnapshot snapshot) {
40+
builder: (context, snapshot) {
4141
return RaisedButton(
4242
child: const Text('Compute on Main'),
4343
elevation: 8.0,
@@ -47,7 +47,7 @@ class _PerformancePageState extends State<PerformancePage> {
4747
),
4848
FutureBuilder<void>(
4949
future: computeFuture,
50-
builder: (BuildContext context, AsyncSnapshot snapshot) {
50+
builder: (context, snapshot) {
5151
return RaisedButton(
5252
child: const Text('Compute on Secondary'),
5353
elevation: 8.0,
@@ -133,7 +133,7 @@ class SmoothAnimationWidget extends StatefulWidget {
133133
class SmoothAnimationWidgetState extends State<SmoothAnimationWidget>
134134
with TickerProviderStateMixin {
135135
AnimationController _controller;
136-
var borderRadius;
136+
Animation<BorderRadius> borderRadius;
137137

138138
@override
139139
void initState() {
@@ -168,10 +168,10 @@ class SmoothAnimationWidgetState extends State<SmoothAnimationWidget>
168168
Widget build(BuildContext context) {
169169
return AnimatedBuilder(
170170
animation: borderRadius,
171-
builder: (BuildContext context, Widget child) {
171+
builder: (context, child) {
172172
return Center(
173173
child: Container(
174-
child: new FlutterLogo(
174+
child: FlutterLogo(
175175
size: 200,
176176
),
177177
alignment: Alignment.bottomCenter,

isolate_example/lib/page_two.dart

Lines changed: 21 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ class InfiniteProcessPage extends StatelessWidget {
4040
'Summation Results',
4141
style: Theme.of(context).textTheme.title,
4242
),
43-
padding: new EdgeInsets.all(8),
43+
padding: EdgeInsets.all(8),
4444
),
4545
Expanded(child: RunningList()),
4646
SafeArea(
@@ -97,7 +97,7 @@ class InfiniteProcessIsolateController extends ChangeNotifier {
9797
}
9898

9999
void listen() {
100-
mIceRP.listen((message) {
100+
mIceRP.listen((dynamic message) {
101101
if (message is SendPort) {
102102
newIceSP = message;
103103
newIceSP.send(_currentMultiplier);
@@ -166,7 +166,7 @@ class RunningList extends StatelessWidget {
166166
decoration: BoxDecoration(
167167
color: Colors.grey[200],
168168
),
169-
child: new ListView.builder(
169+
child: ListView.builder(
170170
itemCount: sums.length,
171171
itemBuilder: (context, index) {
172172
return Column(
@@ -198,7 +198,7 @@ Future<void> _secondIsolateEntryPoint(SendPort callerSP) async {
198198
ReceivePort newIceRP = ReceivePort();
199199
callerSP.send(newIceRP.sendPort);
200200

201-
newIceRP.listen((message) {
201+
newIceRP.listen((dynamic message) {
202202
if (message is int) multiplyValue = message;
203203
});
204204

@@ -216,7 +216,7 @@ Future<void> _secondIsolateEntryPoint(SendPort callerSP) async {
216216
}
217217

218218
Future<int> brokenUpComputation(int num) {
219-
Random rng = new Random();
219+
Random rng = Random();
220220

221221
return Future(() {
222222
int sum = 0;
@@ -228,7 +228,7 @@ Future<int> brokenUpComputation(int num) {
228228
});
229229
}
230230

231-
Widget newButtons(context) {
231+
Widget newButtons(BuildContext context) {
232232
final controller =
233233
Provider.of<InfiniteProcessIsolateController>(context, listen: false);
234234

@@ -249,30 +249,34 @@ Widget newButtons(context) {
249249
);
250250
}
251251

252-
Widget radioButtonWidget(context) {
252+
Widget radioButtonWidget(BuildContext context) {
253253
final controller = Provider.of<InfiniteProcessIsolateController>(context);
254254

255-
return new Row(
255+
return Row(
256256
mainAxisAlignment: MainAxisAlignment.center,
257257
children: [
258-
new Radio(
258+
Radio(
259259
value: 1,
260260
groupValue: controller.multiplier,
261-
onChanged: (_) => controller.setMultiplier(1),
261+
// The following is a result of https://github.com/dart-lang/linter/issues/695
262+
// ignore: avoid_types_on_closure_parameters
263+
onChanged: (int _) => controller.setMultiplier(1),
262264
),
263-
new Text('1x'),
264-
new Radio(
265+
Text('1x'),
266+
Radio(
265267
value: 2,
266268
groupValue: controller.multiplier,
267-
onChanged: (_) => controller.setMultiplier(2),
269+
// ignore: avoid_types_on_closure_parameters
270+
onChanged: (int _) => controller.setMultiplier(2),
268271
),
269-
new Text('2x'),
270-
new Radio(
272+
Text('2x'),
273+
Radio(
271274
value: 3,
272275
groupValue: controller.multiplier,
273-
onChanged: (_) => controller.setMultiplier(3),
276+
// ignore: avoid_types_on_closure_parameters
277+
onChanged: (int _) => controller.setMultiplier(3),
274278
),
275-
new Text('3x'),
279+
Text('3x'),
276280
],
277281
);
278282
}

isolate_example/pubspec.lock

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ packages:
77
name: async
88
url: "https://pub.dartlang.org"
99
source: hosted
10-
version: "2.1.0"
10+
version: "2.2.0"
1111
boolean_selector:
1212
dependency: transitive
1313
description:
@@ -68,7 +68,7 @@ packages:
6868
source: hosted
6969
version: "1.6.2"
7070
pedantic:
71-
dependency: transitive
71+
dependency: "direct dev"
7272
description:
7373
name: pedantic
7474
url: "https://pub.dartlang.org"
@@ -87,7 +87,7 @@ packages:
8787
name: quiver
8888
url: "https://pub.dartlang.org"
8989
source: hosted
90-
version: "2.0.2"
90+
version: "2.0.3"
9191
sky_engine:
9292
dependency: transitive
9393
description: flutter
@@ -134,7 +134,7 @@ packages:
134134
name: test_api
135135
url: "https://pub.dartlang.org"
136136
source: hosted
137-
version: "0.2.4"
137+
version: "0.2.5"
138138
typed_data:
139139
dependency: transitive
140140
description:

isolate_example/pubspec.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ dependencies:
1414
dev_dependencies:
1515
flutter_test:
1616
sdk: flutter
17+
pedantic: ^1.5.0
1718

1819

1920
flutter:

isolate_example/test/widget_test.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
import 'package:flutter_test/flutter_test.dart';
1616

1717
void main() {
18-
testWidgets('This test will always pass', (WidgetTester tester) async {
18+
testWidgets('This test will always pass', (tester) async {
1919
return true;
2020
});
2121
}

0 commit comments

Comments
 (0)