Skip to content

Commit ea3a96d

Browse files
committed
Upgrade the very_good_analysis version to have better analyzer
1 parent 9e39dba commit ea3a96d

File tree

7 files changed

+44
-79
lines changed

7 files changed

+44
-79
lines changed

lib/src/chart/base/axis_chart/axis_chart_helper.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ class AxisChartHelper {
8585
isOverflowed = (axisPosition + (childSize / 2)) > parentAxisSize;
8686
}
8787

88-
if (isOverflowed == false) return Offset.zero;
88+
if (!isOverflowed) return Offset.zero;
8989

9090
// Calc offset if child overflowed
9191
late double offset;

lib/src/chart/base/custom_interactive_viewer.dart

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
// Use of this source code is governed by a BSD-style license that can be
1111
// found in the LICENSE file.
1212

13+
import 'dart:async';
1314
import 'dart:math' as math;
1415

1516
import 'package:flutter/foundation.dart' show clampDouble;
@@ -718,7 +719,7 @@ class _CustomInteractiveViewerState extends State<CustomInteractiveViewer>
718719
);
719720
_controller.duration = Duration(milliseconds: (tFinal * 1000).round());
720721
_animation!.addListener(_onAnimate);
721-
_controller.forward();
722+
unawaited(_controller.forward());
722723
case _GestureType.scale:
723724
if (details.scaleVelocity.abs() < 0.1) {
724725
_currentAxis = null;
@@ -746,7 +747,7 @@ class _CustomInteractiveViewerState extends State<CustomInteractiveViewer>
746747
_scaleController.duration =
747748
Duration(milliseconds: (tFinal * 1000).round());
748749
_scaleAnimation!.addListener(_onScaleAnimate);
749-
_scaleController.forward();
750+
unawaited(_scaleController.forward());
750751
case null:
751752
break;
752753
}

pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ dev_dependencies:
2525
flutter_test:
2626
sdk: flutter
2727
mockito: ^5.5.1
28-
very_good_analysis: ^9.0.0
28+
very_good_analysis: ^10.0.0
2929

3030
screenshots:
3131
- description: "FL Chart Logo"

test/chart/base/axis_chart/axis_chart_helper_test.dart

Lines changed: 35 additions & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -7,47 +7,34 @@ void main() {
77
group('iterateThroughAxis()', () {
88
test('test 1', () {
99
final results = <double>[];
10-
final axisValues = AxisChartHelper().iterateThroughAxis(
11-
min: 0,
12-
max: 0.1,
13-
interval: 0.001,
14-
baseLine: 0,
15-
);
16-
for (final axisValue in axisValues) {
17-
results.add(axisValue);
18-
}
10+
AxisChartHelper()
11+
.iterateThroughAxis(min: 0, max: 0.1, interval: 0.001, baseLine: 0)
12+
.forEach(results.add);
1913
expect(results.length, 101);
2014
});
2115

2216
test('test 2', () {
2317
final results = <double>[];
24-
final axisValues = AxisChartHelper().iterateThroughAxis(
25-
min: 0,
26-
minIncluded: false,
27-
max: 0.1,
28-
maxIncluded: false,
29-
interval: 0.001,
30-
baseLine: 0,
31-
);
32-
for (final axisValue in axisValues) {
33-
results.add(axisValue);
34-
}
18+
AxisChartHelper()
19+
.iterateThroughAxis(
20+
min: 0,
21+
minIncluded: false,
22+
max: 0.1,
23+
maxIncluded: false,
24+
interval: 0.001,
25+
baseLine: 0,
26+
)
27+
.forEach(results.add);
3528
expect(results.length, 99);
3629
expect(results[0], closeTo(0.001, tolerance));
3730
expect(results[98], closeTo(0.099, tolerance));
3831
});
3932

4033
test('test 3', () {
4134
final results = <double>[];
42-
final axisValues = AxisChartHelper().iterateThroughAxis(
43-
min: 0,
44-
max: 1000,
45-
interval: 200,
46-
baseLine: 0,
47-
);
48-
for (final axisValue in axisValues) {
49-
results.add(axisValue);
50-
}
35+
AxisChartHelper()
36+
.iterateThroughAxis(min: 0, max: 1000, interval: 200, baseLine: 0)
37+
.forEach(results.add);
5138
expect(results.length, 6);
5239
expect(results[0], 0);
5340
expect(results[1], 200);
@@ -59,15 +46,9 @@ void main() {
5946

6047
test('test 4', () {
6148
final results = <double>[];
62-
final axisValues = AxisChartHelper().iterateThroughAxis(
63-
min: 0,
64-
max: 10,
65-
interval: 3,
66-
baseLine: 0,
67-
);
68-
for (final axisValue in axisValues) {
69-
results.add(axisValue);
70-
}
49+
AxisChartHelper()
50+
.iterateThroughAxis(min: 0, max: 10, interval: 3, baseLine: 0)
51+
.forEach(results.add);
7152
expect(results.length, 5);
7253
expect(results[0], 0);
7354
expect(results[1], 3);
@@ -78,17 +59,16 @@ void main() {
7859

7960
test('test 5', () {
8061
final results = <double>[];
81-
final axisValues = AxisChartHelper().iterateThroughAxis(
82-
min: 0,
83-
minIncluded: false,
84-
max: 10,
85-
maxIncluded: false,
86-
interval: 3,
87-
baseLine: 0,
88-
);
89-
for (final axisValue in axisValues) {
90-
results.add(axisValue);
91-
}
62+
AxisChartHelper()
63+
.iterateThroughAxis(
64+
min: 0,
65+
minIncluded: false,
66+
max: 10,
67+
maxIncluded: false,
68+
interval: 3,
69+
baseLine: 0,
70+
)
71+
.forEach(results.add);
9272
expect(results.length, 3);
9373
expect(results[0], 3);
9474
expect(results[1], 6);
@@ -97,15 +77,9 @@ void main() {
9777

9878
test('test 6', () {
9979
final results = <double>[];
100-
final axisValues = AxisChartHelper().iterateThroughAxis(
101-
min: 35,
102-
max: 130,
103-
interval: 50,
104-
baseLine: 0,
105-
);
106-
for (final axisValue in axisValues) {
107-
results.add(axisValue);
108-
}
80+
AxisChartHelper()
81+
.iterateThroughAxis(min: 35, max: 130, interval: 50, baseLine: 0)
82+
.forEach(results.add);
10983
expect(results.length, 4);
11084
expect(results[0], 35);
11185
expect(results[1], 50);
@@ -115,15 +89,9 @@ void main() {
11589

11690
test('test 7', () {
11791
final results = <double>[];
118-
final axisValues = AxisChartHelper().iterateThroughAxis(
119-
min: 5,
120-
max: 35,
121-
interval: 10,
122-
baseLine: 5,
123-
);
124-
for (final axisValue in axisValues) {
125-
results.add(axisValue);
126-
}
92+
AxisChartHelper()
93+
.iterateThroughAxis(min: 5, max: 35, interval: 10, baseLine: 5)
94+
.forEach(results.add);
12795
expect(results.length, 4);
12896
expect(results[0], 5);
12997
expect(results[1], 15);

test/chart/base/axis_chart/side_titles/side_titles_flex_test.dart

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -188,8 +188,6 @@ void main() {
188188
const Size(viewSize, 40),
189189
);
190190
expect(
191-
// This is for test
192-
// ignore: invalid_use_of_protected_member
193191
renderFlex.computeDistanceToActualBaseline(TextBaseline.alphabetic),
194192
null,
195193
);
@@ -214,8 +212,6 @@ void main() {
214212
const Size(viewSize, 40),
215213
);
216214
expect(
217-
// This is for test
218-
// ignore: invalid_use_of_protected_member
219215
renderFlex.computeDistanceToActualBaseline(TextBaseline.alphabetic),
220216
null,
221217
);

test/chart/base/render_base_chart_test.dart

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -156,10 +156,6 @@ class TestRenderBaseChart extends RenderBaseChart<LineTouchResponse> {
156156
required this.longPressGestureRecognizerOverride,
157157
}) : super(touchData, context, canBeScaled: canBeScaled);
158158

159-
int panGestureAddPointerCallCount = 0;
160-
int longPressGestureAddPointerCallCount = 0;
161-
int tapGestureAddPointerCallCount = 0;
162-
163159
final PanGestureRecognizer panGestureRecognizerOverride;
164160
final TapGestureRecognizer tapGestureRecognizerOverride;
165161
final LongPressGestureRecognizer longPressGestureRecognizerOverride;

test/helper_methods.dart

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,8 @@ class HelperMethods {
4545
return true;
4646
}
4747

48+
// This is actually used, I don't know why the linter thinks otherwise
49+
// ignore: unreachable_from_main
4850
static bool equalsRRects(
4951
RRect rrect1,
5052
RRect rrect2, {
@@ -85,6 +87,8 @@ class HelperMethods {
8587
return true;
8688
}
8789

90+
// This is actually used, I don't know why the linter thinks otherwise
91+
// ignore: unreachable_from_main
8892
static bool equalsOffsets(
8993
Offset offset1,
9094
Offset offset2, {

0 commit comments

Comments
 (0)