David PHAM-VAN

Remove deprecated avoid_as lint

... ... @@ -84,9 +84,7 @@ Future<Uint8List> generateReport(
grid: pw.CartesianGrid(
xAxis: pw.FixedAxis.fromStrings(
List<String>.generate(
dataTable.length,
// ignore: avoid_as
(index) => dataTable[index][0] as String),
dataTable.length, (index) => dataTable[index][0] as String),
marginStart: 30,
marginEnd: 30,
ticks: true,
... ... @@ -107,7 +105,6 @@ Future<Uint8List> generateReport(
data: List<pw.LineChartValue>.generate(
dataTable.length,
(i) {
// ignore: avoid_as
final v = dataTable[i][2] as num;
return pw.LineChartValue(i.toDouble(), v.toDouble());
},
... ... @@ -122,7 +119,6 @@ Future<Uint8List> generateReport(
data: List<pw.LineChartValue>.generate(
dataTable.length,
(i) {
// ignore: avoid_as
final v = dataTable[i][1] as num;
return pw.LineChartValue(i.toDouble(), v.toDouble());
},
... ... @@ -149,7 +145,6 @@ Future<Uint8List> generateReport(
data: List<pw.LineChartValue>.generate(
dataTable.length,
(i) {
// ignore: avoid_as
final v = dataTable[i][2] as num;
return pw.LineChartValue(i.toDouble(), v.toDouble());
},
... ...
... ... @@ -10,20 +10,17 @@ environment:
dependencies:
flutter:
sdk: flutter
http:
intl:
open_file:
git:
url: https://github.com/orevial/open_file
ref: null-safety-migration
path_provider:
printing:
url_launcher:
http: ^0.13.1
intl: ^0.17.0
open_file: ^3.1.0
path_provider: ^2.0.1
printing: ^5.0.4
url_launcher: ^6.0.3
dev_dependencies:
flutter_test:
sdk: flutter
test:
test: ^1.16.5
dependency_overrides:
pdf:
... ...
... ... @@ -12,7 +12,6 @@ analyzer:
linter:
rules:
- always_put_control_body_on_new_line
- avoid_as
- avoid_bool_literals_in_conditional_expressions
- avoid_classes_with_only_static_members
- avoid_field_initializers_in_const_classes
... ...
... ... @@ -597,7 +597,6 @@ class PdfColorType extends PdfDataType {
@override
void output(PdfStream s) {
if (color is PdfColorCmyk) {
// ignore: avoid_as
final k = color as PdfColorCmyk;
PdfArray.fromNum(<double>[
k.cyan,
... ...
... ... @@ -354,12 +354,8 @@ orientation: $orientation''';
_readTags(buffer, tiffOffset, tiffOffset + firstIFDOffset, bigEnd);
if (tags.containsKey(PdfExifTag.ExifIFDPointer)) {
final exifData = _readTags(
buffer,
tiffOffset,
// ignore: avoid_as
tiffOffset + tags[PdfExifTag.ExifIFDPointer] as int,
bigEnd);
final exifData = _readTags(buffer, tiffOffset,
tiffOffset + tags[PdfExifTag.ExifIFDPointer] as int, bigEnd);
tags.addAll(exifData);
}
... ...
... ... @@ -59,7 +59,6 @@ class Chart extends Widget implements Inherited {
late Widget _child;
// ignore: avoid_as
static Chart of(Context context) => context.dependsOn<Chart>()!;
PdfPoint _computeSize(BoxConstraints constraints) {
... ...
... ... @@ -375,7 +375,6 @@ class FixedAxis<T extends num> extends GridAxis {
return;
}
// ignore: avoid_as
final grid = Chart.of(context).grid as CartesianGrid;
switch (direction) {
... ...
... ... @@ -178,7 +178,6 @@ class PieDataSet extends Dataset {
{bool parentUsesSize = false}) {
final _offset = _isFullCircle ? 0 : offset;
// ignore: avoid_as
final grid = Chart.of(context).grid as PieGrid;
final len = grid.pieSize + _offset;
var x = -len;
... ... @@ -277,7 +276,6 @@ class PieDataSet extends Dataset {
}
void _shape(Context context) {
// ignore: avoid_as
final grid = Chart.of(context).grid as PieGrid;
final bisect = (angleStart + angleEnd) / 2;
... ... @@ -365,7 +363,6 @@ class PieDataSet extends Dataset {
void debugPaint(Context context) {
super.debugPaint(context);
// ignore: avoid_as
final grid = Chart.of(context).grid as PieGrid;
final bisect = (angleStart + angleEnd) / 2;
... ...
... ... @@ -317,7 +317,6 @@ class MultiPage extends Page {
'You probably need a SpanningWidget or use a single page layout');
}
// ignore: avoid_as
final span = child as SpanningWidget;
final localConstraints =
... ...
... ... @@ -81,7 +81,6 @@ class Context {
}
T? dependsOn<T>() {
// ignore: avoid_as
return _inherited[T] as T?;
}
... ...
... ... @@ -12,7 +12,6 @@ analyzer:
linter:
rules:
- always_put_control_body_on_new_line
- avoid_as
- avoid_bool_literals_in_conditional_expressions
- avoid_classes_with_only_static_members
- avoid_field_initializers_in_const_classes
... ...
... ... @@ -208,7 +208,7 @@ class PrintingPlugin extends PrintingPlatform {
final html.CanvasElement canvas =
js.context['document'].createElement('canvas');
// ignore: avoid_as
final context = canvas.getContext('2d') as html.CanvasRenderingContext2D?;
final _pages = pages ?? Iterable<int>.generate(numPages, (index) => index);
... ... @@ -233,7 +233,6 @@ class PrintingPlugin extends PrintingPlatform {
r.readAsArrayBuffer(blob);
r.onLoadEnd.listen(
(ProgressEvent e) {
// ignore: avoid_as
data.add(r.result as List<int>);
completer.complete();
},
... ...
... ... @@ -219,7 +219,7 @@ class _PdfPreviewState extends State<PdfPreview> {
void initState() {
if (widget.initialPageFormat == null) {
final locale = WidgetsBinding.instance!.window.locale;
// ignore: unnecessary_cast, avoid_as
// ignore: unnecessary_cast
final cc = (locale as Locale?)?.countryCode ?? 'US';
if (cc == 'US' || cc == 'CA' || cc == 'MX') {
... ... @@ -562,7 +562,6 @@ class _PdfPreviewState extends State<PdfPreview> {
Future<void> _share() async {
// Calculate the widget center for iPad sharing popup position
final referenceBox =
// ignore: avoid_as
shareWidget.currentContext!.findRenderObject() as RenderBox;
final topLeft =
referenceBox.localToGlobal(referenceBox.paintBounds.topLeft);
... ...
... ... @@ -76,11 +76,9 @@ class WidgetWraper extends pw.ImageProvider {
assert(pixelRatio > 0);
final wrappedWidget =
// ignore: avoid_as
key.currentContext!.findRenderObject() as RenderRepaintBoundary;
final image = await wrappedWidget.toImage(pixelRatio: pixelRatio);
final byteData = await (image.toByteData(format: ui.ImageByteFormat.rawRgba)
// ignore: avoid_as
as FutureOr<ByteData>);
final imageData = byteData.buffer.asUint8List();
return WidgetWraper._(
... ...