Showing
14 changed files
with
12 additions
and
38 deletions
@@ -84,9 +84,7 @@ Future<Uint8List> generateReport( | @@ -84,9 +84,7 @@ Future<Uint8List> generateReport( | ||
84 | grid: pw.CartesianGrid( | 84 | grid: pw.CartesianGrid( |
85 | xAxis: pw.FixedAxis.fromStrings( | 85 | xAxis: pw.FixedAxis.fromStrings( |
86 | List<String>.generate( | 86 | List<String>.generate( |
87 | - dataTable.length, | ||
88 | - // ignore: avoid_as | ||
89 | - (index) => dataTable[index][0] as String), | 87 | + dataTable.length, (index) => dataTable[index][0] as String), |
90 | marginStart: 30, | 88 | marginStart: 30, |
91 | marginEnd: 30, | 89 | marginEnd: 30, |
92 | ticks: true, | 90 | ticks: true, |
@@ -107,7 +105,6 @@ Future<Uint8List> generateReport( | @@ -107,7 +105,6 @@ Future<Uint8List> generateReport( | ||
107 | data: List<pw.LineChartValue>.generate( | 105 | data: List<pw.LineChartValue>.generate( |
108 | dataTable.length, | 106 | dataTable.length, |
109 | (i) { | 107 | (i) { |
110 | - // ignore: avoid_as | ||
111 | final v = dataTable[i][2] as num; | 108 | final v = dataTable[i][2] as num; |
112 | return pw.LineChartValue(i.toDouble(), v.toDouble()); | 109 | return pw.LineChartValue(i.toDouble(), v.toDouble()); |
113 | }, | 110 | }, |
@@ -122,7 +119,6 @@ Future<Uint8List> generateReport( | @@ -122,7 +119,6 @@ Future<Uint8List> generateReport( | ||
122 | data: List<pw.LineChartValue>.generate( | 119 | data: List<pw.LineChartValue>.generate( |
123 | dataTable.length, | 120 | dataTable.length, |
124 | (i) { | 121 | (i) { |
125 | - // ignore: avoid_as | ||
126 | final v = dataTable[i][1] as num; | 122 | final v = dataTable[i][1] as num; |
127 | return pw.LineChartValue(i.toDouble(), v.toDouble()); | 123 | return pw.LineChartValue(i.toDouble(), v.toDouble()); |
128 | }, | 124 | }, |
@@ -149,7 +145,6 @@ Future<Uint8List> generateReport( | @@ -149,7 +145,6 @@ Future<Uint8List> generateReport( | ||
149 | data: List<pw.LineChartValue>.generate( | 145 | data: List<pw.LineChartValue>.generate( |
150 | dataTable.length, | 146 | dataTable.length, |
151 | (i) { | 147 | (i) { |
152 | - // ignore: avoid_as | ||
153 | final v = dataTable[i][2] as num; | 148 | final v = dataTable[i][2] as num; |
154 | return pw.LineChartValue(i.toDouble(), v.toDouble()); | 149 | return pw.LineChartValue(i.toDouble(), v.toDouble()); |
155 | }, | 150 | }, |
@@ -10,20 +10,17 @@ environment: | @@ -10,20 +10,17 @@ environment: | ||
10 | dependencies: | 10 | dependencies: |
11 | flutter: | 11 | flutter: |
12 | sdk: flutter | 12 | sdk: flutter |
13 | - http: | ||
14 | - intl: | ||
15 | - open_file: | ||
16 | - git: | ||
17 | - url: https://github.com/orevial/open_file | ||
18 | - ref: null-safety-migration | ||
19 | - path_provider: | ||
20 | - printing: | ||
21 | - url_launcher: | 13 | + http: ^0.13.1 |
14 | + intl: ^0.17.0 | ||
15 | + open_file: ^3.1.0 | ||
16 | + path_provider: ^2.0.1 | ||
17 | + printing: ^5.0.4 | ||
18 | + url_launcher: ^6.0.3 | ||
22 | 19 | ||
23 | dev_dependencies: | 20 | dev_dependencies: |
24 | flutter_test: | 21 | flutter_test: |
25 | sdk: flutter | 22 | sdk: flutter |
26 | - test: | 23 | + test: ^1.16.5 |
27 | 24 | ||
28 | dependency_overrides: | 25 | dependency_overrides: |
29 | pdf: | 26 | pdf: |
@@ -12,7 +12,6 @@ analyzer: | @@ -12,7 +12,6 @@ analyzer: | ||
12 | linter: | 12 | linter: |
13 | rules: | 13 | rules: |
14 | - always_put_control_body_on_new_line | 14 | - always_put_control_body_on_new_line |
15 | - - avoid_as | ||
16 | - avoid_bool_literals_in_conditional_expressions | 15 | - avoid_bool_literals_in_conditional_expressions |
17 | - avoid_classes_with_only_static_members | 16 | - avoid_classes_with_only_static_members |
18 | - avoid_field_initializers_in_const_classes | 17 | - avoid_field_initializers_in_const_classes |
@@ -597,7 +597,6 @@ class PdfColorType extends PdfDataType { | @@ -597,7 +597,6 @@ class PdfColorType extends PdfDataType { | ||
597 | @override | 597 | @override |
598 | void output(PdfStream s) { | 598 | void output(PdfStream s) { |
599 | if (color is PdfColorCmyk) { | 599 | if (color is PdfColorCmyk) { |
600 | - // ignore: avoid_as | ||
601 | final k = color as PdfColorCmyk; | 600 | final k = color as PdfColorCmyk; |
602 | PdfArray.fromNum(<double>[ | 601 | PdfArray.fromNum(<double>[ |
603 | k.cyan, | 602 | k.cyan, |
@@ -354,12 +354,8 @@ orientation: $orientation'''; | @@ -354,12 +354,8 @@ orientation: $orientation'''; | ||
354 | _readTags(buffer, tiffOffset, tiffOffset + firstIFDOffset, bigEnd); | 354 | _readTags(buffer, tiffOffset, tiffOffset + firstIFDOffset, bigEnd); |
355 | 355 | ||
356 | if (tags.containsKey(PdfExifTag.ExifIFDPointer)) { | 356 | if (tags.containsKey(PdfExifTag.ExifIFDPointer)) { |
357 | - final exifData = _readTags( | ||
358 | - buffer, | ||
359 | - tiffOffset, | ||
360 | - // ignore: avoid_as | ||
361 | - tiffOffset + tags[PdfExifTag.ExifIFDPointer] as int, | ||
362 | - bigEnd); | 357 | + final exifData = _readTags(buffer, tiffOffset, |
358 | + tiffOffset + tags[PdfExifTag.ExifIFDPointer] as int, bigEnd); | ||
363 | tags.addAll(exifData); | 359 | tags.addAll(exifData); |
364 | } | 360 | } |
365 | 361 |
@@ -59,7 +59,6 @@ class Chart extends Widget implements Inherited { | @@ -59,7 +59,6 @@ class Chart extends Widget implements Inherited { | ||
59 | 59 | ||
60 | late Widget _child; | 60 | late Widget _child; |
61 | 61 | ||
62 | - // ignore: avoid_as | ||
63 | static Chart of(Context context) => context.dependsOn<Chart>()!; | 62 | static Chart of(Context context) => context.dependsOn<Chart>()!; |
64 | 63 | ||
65 | PdfPoint _computeSize(BoxConstraints constraints) { | 64 | PdfPoint _computeSize(BoxConstraints constraints) { |
@@ -375,7 +375,6 @@ class FixedAxis<T extends num> extends GridAxis { | @@ -375,7 +375,6 @@ class FixedAxis<T extends num> extends GridAxis { | ||
375 | return; | 375 | return; |
376 | } | 376 | } |
377 | 377 | ||
378 | - // ignore: avoid_as | ||
379 | final grid = Chart.of(context).grid as CartesianGrid; | 378 | final grid = Chart.of(context).grid as CartesianGrid; |
380 | 379 | ||
381 | switch (direction) { | 380 | switch (direction) { |
@@ -178,7 +178,6 @@ class PieDataSet extends Dataset { | @@ -178,7 +178,6 @@ class PieDataSet extends Dataset { | ||
178 | {bool parentUsesSize = false}) { | 178 | {bool parentUsesSize = false}) { |
179 | final _offset = _isFullCircle ? 0 : offset; | 179 | final _offset = _isFullCircle ? 0 : offset; |
180 | 180 | ||
181 | - // ignore: avoid_as | ||
182 | final grid = Chart.of(context).grid as PieGrid; | 181 | final grid = Chart.of(context).grid as PieGrid; |
183 | final len = grid.pieSize + _offset; | 182 | final len = grid.pieSize + _offset; |
184 | var x = -len; | 183 | var x = -len; |
@@ -277,7 +276,6 @@ class PieDataSet extends Dataset { | @@ -277,7 +276,6 @@ class PieDataSet extends Dataset { | ||
277 | } | 276 | } |
278 | 277 | ||
279 | void _shape(Context context) { | 278 | void _shape(Context context) { |
280 | - // ignore: avoid_as | ||
281 | final grid = Chart.of(context).grid as PieGrid; | 279 | final grid = Chart.of(context).grid as PieGrid; |
282 | 280 | ||
283 | final bisect = (angleStart + angleEnd) / 2; | 281 | final bisect = (angleStart + angleEnd) / 2; |
@@ -365,7 +363,6 @@ class PieDataSet extends Dataset { | @@ -365,7 +363,6 @@ class PieDataSet extends Dataset { | ||
365 | void debugPaint(Context context) { | 363 | void debugPaint(Context context) { |
366 | super.debugPaint(context); | 364 | super.debugPaint(context); |
367 | 365 | ||
368 | - // ignore: avoid_as | ||
369 | final grid = Chart.of(context).grid as PieGrid; | 366 | final grid = Chart.of(context).grid as PieGrid; |
370 | 367 | ||
371 | final bisect = (angleStart + angleEnd) / 2; | 368 | final bisect = (angleStart + angleEnd) / 2; |
@@ -317,7 +317,6 @@ class MultiPage extends Page { | @@ -317,7 +317,6 @@ class MultiPage extends Page { | ||
317 | 'You probably need a SpanningWidget or use a single page layout'); | 317 | 'You probably need a SpanningWidget or use a single page layout'); |
318 | } | 318 | } |
319 | 319 | ||
320 | - // ignore: avoid_as | ||
321 | final span = child as SpanningWidget; | 320 | final span = child as SpanningWidget; |
322 | 321 | ||
323 | final localConstraints = | 322 | final localConstraints = |
@@ -12,7 +12,6 @@ analyzer: | @@ -12,7 +12,6 @@ analyzer: | ||
12 | linter: | 12 | linter: |
13 | rules: | 13 | rules: |
14 | - always_put_control_body_on_new_line | 14 | - always_put_control_body_on_new_line |
15 | - - avoid_as | ||
16 | - avoid_bool_literals_in_conditional_expressions | 15 | - avoid_bool_literals_in_conditional_expressions |
17 | - avoid_classes_with_only_static_members | 16 | - avoid_classes_with_only_static_members |
18 | - avoid_field_initializers_in_const_classes | 17 | - avoid_field_initializers_in_const_classes |
@@ -208,7 +208,7 @@ class PrintingPlugin extends PrintingPlatform { | @@ -208,7 +208,7 @@ class PrintingPlugin extends PrintingPlatform { | ||
208 | 208 | ||
209 | final html.CanvasElement canvas = | 209 | final html.CanvasElement canvas = |
210 | js.context['document'].createElement('canvas'); | 210 | js.context['document'].createElement('canvas'); |
211 | - // ignore: avoid_as | 211 | + |
212 | final context = canvas.getContext('2d') as html.CanvasRenderingContext2D?; | 212 | final context = canvas.getContext('2d') as html.CanvasRenderingContext2D?; |
213 | final _pages = pages ?? Iterable<int>.generate(numPages, (index) => index); | 213 | final _pages = pages ?? Iterable<int>.generate(numPages, (index) => index); |
214 | 214 | ||
@@ -233,7 +233,6 @@ class PrintingPlugin extends PrintingPlatform { | @@ -233,7 +233,6 @@ class PrintingPlugin extends PrintingPlatform { | ||
233 | r.readAsArrayBuffer(blob); | 233 | r.readAsArrayBuffer(blob); |
234 | r.onLoadEnd.listen( | 234 | r.onLoadEnd.listen( |
235 | (ProgressEvent e) { | 235 | (ProgressEvent e) { |
236 | - // ignore: avoid_as | ||
237 | data.add(r.result as List<int>); | 236 | data.add(r.result as List<int>); |
238 | completer.complete(); | 237 | completer.complete(); |
239 | }, | 238 | }, |
@@ -219,7 +219,7 @@ class _PdfPreviewState extends State<PdfPreview> { | @@ -219,7 +219,7 @@ class _PdfPreviewState extends State<PdfPreview> { | ||
219 | void initState() { | 219 | void initState() { |
220 | if (widget.initialPageFormat == null) { | 220 | if (widget.initialPageFormat == null) { |
221 | final locale = WidgetsBinding.instance!.window.locale; | 221 | final locale = WidgetsBinding.instance!.window.locale; |
222 | - // ignore: unnecessary_cast, avoid_as | 222 | + // ignore: unnecessary_cast |
223 | final cc = (locale as Locale?)?.countryCode ?? 'US'; | 223 | final cc = (locale as Locale?)?.countryCode ?? 'US'; |
224 | 224 | ||
225 | if (cc == 'US' || cc == 'CA' || cc == 'MX') { | 225 | if (cc == 'US' || cc == 'CA' || cc == 'MX') { |
@@ -562,7 +562,6 @@ class _PdfPreviewState extends State<PdfPreview> { | @@ -562,7 +562,6 @@ class _PdfPreviewState extends State<PdfPreview> { | ||
562 | Future<void> _share() async { | 562 | Future<void> _share() async { |
563 | // Calculate the widget center for iPad sharing popup position | 563 | // Calculate the widget center for iPad sharing popup position |
564 | final referenceBox = | 564 | final referenceBox = |
565 | - // ignore: avoid_as | ||
566 | shareWidget.currentContext!.findRenderObject() as RenderBox; | 565 | shareWidget.currentContext!.findRenderObject() as RenderBox; |
567 | final topLeft = | 566 | final topLeft = |
568 | referenceBox.localToGlobal(referenceBox.paintBounds.topLeft); | 567 | referenceBox.localToGlobal(referenceBox.paintBounds.topLeft); |
@@ -76,11 +76,9 @@ class WidgetWraper extends pw.ImageProvider { | @@ -76,11 +76,9 @@ class WidgetWraper extends pw.ImageProvider { | ||
76 | assert(pixelRatio > 0); | 76 | assert(pixelRatio > 0); |
77 | 77 | ||
78 | final wrappedWidget = | 78 | final wrappedWidget = |
79 | - // ignore: avoid_as | ||
80 | key.currentContext!.findRenderObject() as RenderRepaintBoundary; | 79 | key.currentContext!.findRenderObject() as RenderRepaintBoundary; |
81 | final image = await wrappedWidget.toImage(pixelRatio: pixelRatio); | 80 | final image = await wrappedWidget.toImage(pixelRatio: pixelRatio); |
82 | final byteData = await (image.toByteData(format: ui.ImageByteFormat.rawRgba) | 81 | final byteData = await (image.toByteData(format: ui.ImageByteFormat.rawRgba) |
83 | - // ignore: avoid_as | ||
84 | as FutureOr<ByteData>); | 82 | as FutureOr<ByteData>); |
85 | final imageData = byteData.buffer.asUint8List(); | 83 | final imageData = byteData.buffer.asUint8List(); |
86 | return WidgetWraper._( | 84 | return WidgetWraper._( |
-
Please register or login to post a comment