David PHAM-VAN

Optimize for loops

@@ -204,7 +204,7 @@ class PdfString extends PdfDataType { @@ -204,7 +204,7 @@ class PdfString extends PdfDataType {
204 encoding.add(unit & UNICODE_BYTE_ZERO_MASK); 204 encoding.add(unit & UNICODE_BYTE_ZERO_MASK);
205 } 205 }
206 206
207 - for (var unit in str.codeUnits) { 207 + for (final unit in str.codeUnits) {
208 if ((unit >= 0 && unit < UNICODE_UTF16_RESERVED_LO) || 208 if ((unit >= 0 && unit < UNICODE_UTF16_RESERVED_LO) ||
209 (unit > UNICODE_UTF16_RESERVED_HI && unit <= UNICODE_PLANE_ONE_MAX)) { 209 (unit > UNICODE_UTF16_RESERVED_HI && unit <= UNICODE_PLANE_ONE_MAX)) {
210 add(unit); 210 add(unit);
@@ -225,7 +225,7 @@ class PdfString extends PdfDataType { @@ -225,7 +225,7 @@ class PdfString extends PdfDataType {
225 /// Escape special characters 225 /// Escape special characters
226 /// \ddd Character code ddd (octal) 226 /// \ddd Character code ddd (octal)
227 void _putTextBytes(PdfStream s, List<int> b) { 227 void _putTextBytes(PdfStream s, List<int> b) {
228 - for (var c in b) { 228 + for (final c in b) {
229 switch (c) { 229 switch (c) {
230 case 0x0a: // \n Line feed (LF) 230 case 0x0a: // \n Line feed (LF)
231 s.putByte(0x5c); 231 s.putByte(0x5c);
@@ -274,7 +274,7 @@ class PdfString extends PdfDataType { @@ -274,7 +274,7 @@ class PdfString extends PdfDataType {
274 switch (format) { 274 switch (format) {
275 case PdfStringFormat.binary: 275 case PdfStringFormat.binary:
276 s.putByte(0x3c); 276 s.putByte(0x3c);
277 - for (var byte in value) { 277 + for (final byte in value) {
278 s.putByte(_codeUnitForDigit((byte & 0xF0) >> 4)); 278 s.putByte(_codeUnitForDigit((byte & 0xF0) >> 4));
279 s.putByte(_codeUnitForDigit(byte & 0x0F)); 279 s.putByte(_codeUnitForDigit(byte & 0x0F));
280 } 280 }
@@ -326,7 +326,7 @@ Iterable<String> _parse(String text) sync* { @@ -326,7 +326,7 @@ Iterable<String> _parse(String text) sync* {
326 final notArabicWords = <List<int>>[]; 326 final notArabicWords = <List<int>>[];
327 327
328 var first = true; 328 var first = true;
329 - for (var word in words) { 329 + for (final word in words) {
330 final newWord = <int>[]; 330 final newWord = <int>[];
331 var isNewWordArabic = false; 331 var isNewWordArabic = false;
332 332
@@ -375,7 +375,7 @@ Iterable<String> _parse(String text) sync* { @@ -375,7 +375,7 @@ Iterable<String> _parse(String text) sync* {
375 375
376 if (isNewWordArabic) { 376 if (isNewWordArabic) {
377 isNewWordArabic = false; 377 isNewWordArabic = false;
378 - for (var notArabicNewWord in notArabicWords) { 378 + for (final notArabicNewWord in notArabicWords) {
379 yield '${String.fromCharCodes(notArabicNewWord)} '; 379 yield '${String.fromCharCodes(notArabicNewWord)} ';
380 } 380 }
381 notArabicWords.clear(); 381 notArabicWords.clear();
@@ -57,7 +57,7 @@ class PdfFontMetrics { @@ -57,7 +57,7 @@ class PdfFontMetrics {
57 double? firstBearing; 57 double? firstBearing;
58 late double spacing; 58 late double spacing;
59 59
60 - for (var metric in metrics) { 60 + for (final metric in metrics) {
61 firstBearing ??= metric.leftBearing; 61 firstBearing ??= metric.leftBearing;
62 left ??= metric.left; 62 left ??= metric.left;
63 spacing = metric.advanceWidth > 0 ? letterSpacing : 0.0; 63 spacing = metric.advanceWidth > 0 ? letterSpacing : 0.0;
@@ -303,15 +303,15 @@ class TtfParser { @@ -303,15 +303,15 @@ class TtfParser {
303 303
304 /// https://developer.apple.com/fonts/TrueType-Reference-Manual/RM06/Chap6glyf.html 304 /// https://developer.apple.com/fonts/TrueType-Reference-Manual/RM06/Chap6glyf.html
305 void _parseGlyphs() { 305 void _parseGlyphs() {
306 - final baseOffset = tableOffsets[glyf_table]; 306 + final baseOffset = tableOffsets[glyf_table]!;
307 final hmtxOffset = tableOffsets[hmtx_table]!; 307 final hmtxOffset = tableOffsets[hmtx_table]!;
308 final unitsPerEm = this.unitsPerEm; 308 final unitsPerEm = this.unitsPerEm;
309 final numOfLongHorMetrics = this.numOfLongHorMetrics; 309 final numOfLongHorMetrics = this.numOfLongHorMetrics;
310 final defaultadvanceWidth = 310 final defaultadvanceWidth =
311 bytes.getUint16(hmtxOffset + (numOfLongHorMetrics - 1) * 4); 311 bytes.getUint16(hmtxOffset + (numOfLongHorMetrics - 1) * 4);
312 var glyphIndex = 0; 312 var glyphIndex = 0;
313 - for (var offset in glyphOffsets) {  
314 - final xMin = bytes.getInt16(baseOffset! + offset + 2); // 2 313 + for (final offset in glyphOffsets) {
  314 + final xMin = bytes.getInt16(baseOffset + offset + 2); // 2
315 final yMin = bytes.getInt16(baseOffset + offset + 4); // 4 315 final yMin = bytes.getInt16(baseOffset + offset + 4); // 4
316 final xMax = bytes.getInt16(baseOffset + offset + 6); // 6 316 final xMax = bytes.getInt16(baseOffset + offset + 6); // 6
317 final yMax = bytes.getInt16(baseOffset + offset + 8); // 8 317 final yMax = bytes.getInt16(baseOffset + offset + 8); // 8
@@ -78,14 +78,14 @@ class TtfWriter { @@ -78,14 +78,14 @@ class TtfWriter {
78 78
79 final glyph = 79 final glyph =
80 ttf.readGlyph(ttf.charToGlyphIndexMap[chars[index]] ?? 0).copy(); 80 ttf.readGlyph(ttf.charToGlyphIndexMap[chars[index]] ?? 0).copy();
81 - for (var g in glyph.compounds) { 81 + for (final g in glyph.compounds) {
82 compounds[g] = -1; 82 compounds[g] = -1;
83 } 83 }
84 glyphsInfo.add(glyph); 84 glyphsInfo.add(glyph);
85 } 85 }
86 86
87 // Add compound glyphs 87 // Add compound glyphs
88 - for (var compound in compounds.keys) { 88 + for (final compound in compounds.keys) {
89 final index = glyphsInfo.firstWhere( 89 final index = glyphsInfo.firstWhere(
90 (TtfGlyphInfo glyph) => glyph.index == compound, 90 (TtfGlyphInfo glyph) => glyph.index == compound,
91 orElse: () { 91 orElse: () {
@@ -106,14 +106,14 @@ class TtfWriter { @@ -106,14 +106,14 @@ class TtfWriter {
106 glyphsInfo.add(glyph); 106 glyphsInfo.add(glyph);
107 107
108 // update compound indices 108 // update compound indices
109 - for (var glyph in glyphsInfo) { 109 + for (final glyph in glyphsInfo) {
110 if (glyph.compounds.isNotEmpty) { 110 if (glyph.compounds.isNotEmpty) {
111 _updateCompoundGlyph(glyph, compounds); 111 _updateCompoundGlyph(glyph, compounds);
112 } 112 }
113 } 113 }
114 114
115 var glyphsTableLength = 0; 115 var glyphsTableLength = 0;
116 - for (var glyph in glyphsInfo) { 116 + for (final glyph in glyphsInfo) {
117 glyphsTableLength = 117 glyphsTableLength =
118 _wordAlign(glyphsTableLength + glyph.data.lengthInBytes); 118 _wordAlign(glyphsTableLength + glyph.data.lengthInBytes);
119 } 119 }
@@ -136,7 +136,7 @@ class TtfWriter { @@ -136,7 +136,7 @@ class TtfWriter {
136 { 136 {
137 final loca = tables[TtfParser.loca_table]!.buffer.asByteData(); 137 final loca = tables[TtfParser.loca_table]!.buffer.asByteData();
138 var index = 0; 138 var index = 0;
139 - for (var glyph in glyphsInfo) { 139 + for (final glyph in glyphsInfo) {
140 if (ttf.indexToLocFormat == 0) { 140 if (ttf.indexToLocFormat == 0) {
141 loca.setUint16(index, offset ~/ 2); 141 loca.setUint16(index, offset ~/ 2);
142 index += 2; 142 index += 2;
@@ -195,7 +195,7 @@ class TtfWriter { @@ -195,7 +195,7 @@ class TtfWriter {
195 final defaultadvanceWidth = 195 final defaultadvanceWidth =
196 ttf.bytes.getUint16(hmtxOffset + (numOfLongHorMetrics - 1) * 4); 196 ttf.bytes.getUint16(hmtxOffset + (numOfLongHorMetrics - 1) * 4);
197 var index = 0; 197 var index = 0;
198 - for (var glyph in glyphsInfo) { 198 + for (final glyph in glyphsInfo) {
199 final advanceWidth = glyph.index < numOfLongHorMetrics 199 final advanceWidth = glyph.index < numOfLongHorMetrics
200 ? ttf.bytes.getUint16(hmtxOffset + glyph.index * 4) 200 ? ttf.bytes.getUint16(hmtxOffset + glyph.index * 4)
201 : defaultadvanceWidth; 201 : defaultadvanceWidth;
@@ -104,8 +104,8 @@ class PdfCatalog extends PdfObjectDict { @@ -104,8 +104,8 @@ class PdfCatalog extends PdfObjectDict {
104 } 104 }
105 105
106 final widgets = <PdfAnnot>[]; 106 final widgets = <PdfAnnot>[];
107 - for (var page in pdfDocument.pdfPageList.pages) {  
108 - for (var annot in page.annotations) { 107 + for (final page in pdfDocument.pdfPageList.pages) {
  108 + for (final annot in page.annotations) {
109 if (annot.annot.subtype == '/Widget') { 109 if (annot.annot.subtype == '/Widget') {
110 widgets.add(annot); 110 widgets.add(annot);
111 } 111 }
@@ -55,7 +55,7 @@ class PdfNames extends PdfObjectDict { @@ -55,7 +55,7 @@ class PdfNames extends PdfObjectDict {
55 55
56 final keys = _dests.keys.toList()..sort(); 56 final keys = _dests.keys.toList()..sort();
57 57
58 - for (var name in keys) { 58 + for (final name in keys) {
59 dests.add(PdfSecString.fromString(this, name)); 59 dests.add(PdfSecString.fromString(this, name));
60 dests.add(_dests[name]!); 60 dests.add(_dests[name]!);
61 } 61 }
@@ -189,7 +189,7 @@ class PdfOutline extends PdfObjectDict { @@ -189,7 +189,7 @@ class PdfOutline extends PdfObjectDict {
189 var c = outlines.length; // initially the number of kids 189 var c = outlines.length; // initially the number of kids
190 190
191 // now call each one for their descendants 191 // now call each one for their descendants
192 - for (var o in outlines) { 192 + for (final o in outlines) {
193 c += o.descendants(); 193 c += o.descendants();
194 } 194 }
195 195
@@ -163,7 +163,7 @@ class PdfTtfFont extends PdfFont { @@ -163,7 +163,7 @@ class PdfTtfFont extends PdfFont {
163 final runes = text.runes; 163 final runes = text.runes;
164 164
165 stream.putByte(0x3c); 165 stream.putByte(0x3c);
166 - for (var rune in runes) { 166 + for (final rune in runes) {
167 var char = unicodeCMap.cmap.indexOf(rune); 167 var char = unicodeCMap.cmap.indexOf(rune);
168 if (char == -1) { 168 if (char == -1) {
169 char = unicodeCMap.cmap.length; 169 char = unicodeCMap.cmap.length;
@@ -100,7 +100,7 @@ class PdfXrefTable extends PdfDataType { @@ -100,7 +100,7 @@ class PdfXrefTable extends PdfDataType {
100 void _writeblock(PdfStream s, int firstid, List<PdfXref> block) { 100 void _writeblock(PdfStream s, int firstid, List<PdfXref> block) {
101 s.putString('$firstid ${block.length}\n'); 101 s.putString('$firstid ${block.length}\n');
102 102
103 - for (var x in block) { 103 + for (final x in block) {
104 s.putString(x.ref()); 104 s.putString(x.ref());
105 s.putByte(0x0a); 105 s.putByte(0x0a);
106 } 106 }
@@ -125,7 +125,7 @@ class PdfXrefTable extends PdfDataType { @@ -125,7 +125,7 @@ class PdfXrefTable extends PdfDataType {
125 type: PdfCrossRefEntryType.free, 125 type: PdfCrossRefEntryType.free,
126 )); 126 ));
127 127
128 - for (var x in offsets) { 128 + for (final x in offsets) {
129 // check to see if block is in range 129 // check to see if block is in range
130 if (x.id != (lastid + 1)) { 130 if (x.id != (lastid + 1)) {
131 // no, so write this block, and reset 131 // no, so write this block, and reset
@@ -165,7 +165,7 @@ class PdfXrefTable extends PdfDataType { @@ -165,7 +165,7 @@ class PdfXrefTable extends PdfDataType {
165 // We need block 0 to exist 165 // We need block 0 to exist
166 blocks.add(firstid); 166 blocks.add(firstid);
167 167
168 - for (var x in offsets) { 168 + for (final x in offsets) {
169 // check to see if block is in range 169 // check to see if block is in range
170 if (x.id != (lastid + 1)) { 170 if (x.id != (lastid + 1)) {
171 // no, so store this block, and reset 171 // no, so store this block, and reset
@@ -195,7 +195,7 @@ class PdfXrefTable extends PdfDataType { @@ -195,7 +195,7 @@ class PdfXrefTable extends PdfDataType {
195 // Write offset zero, all zeros 195 // Write offset zero, all zeros
196 ofs += wl; 196 ofs += wl;
197 197
198 - for (var x in offsets) { 198 + for (final x in offsets) {
199 ofs = x.cref(o, ofs, w); 199 ofs = x.cref(o, ofs, w);
200 } 200 }
201 201
@@ -64,7 +64,7 @@ class _BarcodeWidget extends Widget { @@ -64,7 +64,7 @@ class _BarcodeWidget extends Widget {
64 64
65 final textList = <BarcodeText>[]; 65 final textList = <BarcodeText>[];
66 66
67 - for (var element in barcode!.makeBytes( 67 + for (final element in barcode!.makeBytes(
68 data, 68 data,
69 width: box!.width, 69 width: box!.width,
70 height: box!.height, 70 height: box!.height,
@@ -93,7 +93,7 @@ class _BarcodeWidget extends Widget { @@ -93,7 +93,7 @@ class _BarcodeWidget extends Widget {
93 if (drawText!) { 93 if (drawText!) {
94 final font = textStyle!.font!.getFont(context); 94 final font = textStyle!.font!.getFont(context);
95 95
96 - for (var text in textList) { 96 + for (final text in textList) {
97 final metrics = font!.stringMetrics(text.text); 97 final metrics = font!.stringMetrics(text.text);
98 98
99 final top = box!.top - 99 final top = box!.top -
@@ -136,7 +136,7 @@ class _BarcodeWidget extends Widget { @@ -136,7 +136,7 @@ class _BarcodeWidget extends Widget {
136 super.debugPaint(context); 136 super.debugPaint(context);
137 137
138 if (drawText!) { 138 if (drawText!) {
139 - for (var element in barcode!.makeBytes( 139 + for (final element in barcode!.makeBytes(
140 data, 140 data,
141 width: box!.width, 141 width: box!.width,
142 height: box!.height, 142 height: box!.height,
@@ -105,13 +105,13 @@ class CartesianGrid extends ChartGrid { @@ -105,13 +105,13 @@ class CartesianGrid extends ChartGrid {
105 final datasets = Chart.of(context).datasets; 105 final datasets = Chart.of(context).datasets;
106 106
107 clip(context, box!.size); 107 clip(context, box!.size);
108 - for (var dataSet in datasets) { 108 + for (final dataSet in datasets) {
109 dataSet.paintBackground(context); 109 dataSet.paintBackground(context);
110 } 110 }
111 context.canvas.restoreContext(); 111 context.canvas.restoreContext();
112 paintBackground(context); 112 paintBackground(context);
113 clip(context, box!.size); 113 clip(context, box!.size);
114 - for (var dataSet in datasets) { 114 + for (final dataSet in datasets) {
115 dataSet.paint(context); 115 dataSet.paint(context);
116 } 116 }
117 context.canvas.restoreContext(); 117 context.canvas.restoreContext();
@@ -69,13 +69,13 @@ class RadialGrid extends ChartGrid { @@ -69,13 +69,13 @@ class RadialGrid extends ChartGrid {
69 final datasets = Chart.of(context).datasets; 69 final datasets = Chart.of(context).datasets;
70 70
71 clip(context, box!.size); 71 clip(context, box!.size);
72 - for (var dataSet in datasets) { 72 + for (final dataSet in datasets) {
73 dataSet.paintBackground(context); 73 dataSet.paintBackground(context);
74 } 74 }
75 context.canvas.restoreContext(); 75 context.canvas.restoreContext();
76 paintBackground(context); 76 paintBackground(context);
77 clip(context, box!.size); 77 clip(context, box!.size);
78 - for (var dataSet in datasets) { 78 + for (final dataSet in datasets) {
79 dataSet.paint(context); 79 dataSet.paint(context);
80 } 80 }
81 context.canvas.restoreContext(); 81 context.canvas.restoreContext();
@@ -88,19 +88,19 @@ class PieGrid extends ChartGrid { @@ -88,19 +88,19 @@ class PieGrid extends ChartGrid {
88 Matrix4.translationValues(box!.width / 2, box!.height / 2, 0), 88 Matrix4.translationValues(box!.width / 2, box!.height / 2, 0),
89 ); 89 );
90 90
91 - for (var dataSet in datasets) { 91 + for (final dataSet in datasets) {
92 if (dataSet is PieDataSet) { 92 if (dataSet is PieDataSet) {
93 dataSet.paintBackground(context); 93 dataSet.paintBackground(context);
94 } 94 }
95 } 95 }
96 96
97 - for (var dataSet in datasets) { 97 + for (final dataSet in datasets) {
98 if (dataSet is PieDataSet) { 98 if (dataSet is PieDataSet) {
99 dataSet.paint(context); 99 dataSet.paint(context);
100 } 100 }
101 } 101 }
102 102
103 - for (var dataSet in datasets) { 103 + for (final dataSet in datasets) {
104 if (dataSet is PieDataSet) { 104 if (dataSet is PieDataSet) {
105 dataSet.paintLegend(context); 105 dataSet.paintLegend(context);
106 } 106 }
@@ -121,7 +121,7 @@ class Document { @@ -121,7 +121,7 @@ class Document {
121 121
122 Future<Uint8List> save() async { 122 Future<Uint8List> save() async {
123 if (!_paint) { 123 if (!_paint) {
124 - for (var page in _pages) { 124 + for (final page in _pages) {
125 page.postProcess(this); 125 page.postProcess(this);
126 } 126 }
127 _paint = true; 127 _paint = true;
@@ -118,7 +118,7 @@ class Flex extends MultiChildWidget with SpanningWidget { @@ -118,7 +118,7 @@ class Flex extends MultiChildWidget with SpanningWidget {
118 var inflexibleSpace = 0.0; 118 var inflexibleSpace = 0.0;
119 var maxFlexFractionSoFar = 0.0; 119 var maxFlexFractionSoFar = 0.0;
120 120
121 - for (var child in children) { 121 + for (final child in children) {
122 final flex = child is Flexible ? child.flex : 0; 122 final flex = child is Flexible ? child.flex : 0;
123 totalFlex += flex; 123 totalFlex += flex;
124 if (flex > 0) { 124 if (flex > 0) {
@@ -140,7 +140,7 @@ class Flex extends MultiChildWidget with SpanningWidget { @@ -140,7 +140,7 @@ class Flex extends MultiChildWidget with SpanningWidget {
140 var totalFlex = 0; 140 var totalFlex = 0;
141 var inflexibleSpace = 0.0; 141 var inflexibleSpace = 0.0;
142 var maxCrossSize = 0.0; 142 var maxCrossSize = 0.0;
143 - for (var child in children) { 143 + for (final child in children) {
144 final flex = child is Flexible ? child.flex : 0; 144 final flex = child is Flexible ? child.flex : 0;
145 totalFlex += flex; 145 totalFlex += flex;
146 double? mainSize; 146 double? mainSize;
@@ -167,7 +167,7 @@ class Flex extends MultiChildWidget with SpanningWidget { @@ -167,7 +167,7 @@ class Flex extends MultiChildWidget with SpanningWidget {
167 math.max(0.0, (availableMainSpace! - inflexibleSpace) / totalFlex); 167 math.max(0.0, (availableMainSpace! - inflexibleSpace) / totalFlex);
168 168
169 // Size remaining (flexible) items, find the maximum cross size. 169 // Size remaining (flexible) items, find the maximum cross size.
170 - for (var child in children) { 170 + for (final child in children) {
171 final flex = child is Flexible ? child.flex : 0; 171 final flex = child is Flexible ? child.flex : 0;
172 if (flex > 0) { 172 if (flex > 0) {
173 maxCrossSize = 173 maxCrossSize =
@@ -241,7 +241,7 @@ class Flex extends MultiChildWidget with SpanningWidget { @@ -241,7 +241,7 @@ class Flex extends MultiChildWidget with SpanningWidget {
241 var allocatedSize = 0.0; // Sum of the sizes of the non-flexible children. 241 var allocatedSize = 0.0; // Sum of the sizes of the non-flexible children.
242 var index = _context.firstChild; 242 var index = _context.firstChild;
243 243
244 - for (var child in children.sublist(_context.firstChild)) { 244 + for (final child in children.sublist(_context.firstChild)) {
245 final flex = child is Flexible ? child.flex : 0; 245 final flex = child is Flexible ? child.flex : 0;
246 final fit = child is Flexible ? child.fit : FlexFit.loose; 246 final fit = child is Flexible ? child.fit : FlexFit.loose;
247 if (flex > 0) { 247 if (flex > 0) {
@@ -305,7 +305,7 @@ class Flex extends MultiChildWidget with SpanningWidget { @@ -305,7 +305,7 @@ class Flex extends MultiChildWidget with SpanningWidget {
305 final spacePerFlex = 305 final spacePerFlex =
306 canFlex && totalFlex > 0 ? (freeSpace / totalFlex) : double.nan; 306 canFlex && totalFlex > 0 ? (freeSpace / totalFlex) : double.nan;
307 307
308 - for (var child in children) { 308 + for (final child in children) {
309 final flex = child is Flexible ? child.flex : 0; 309 final flex = child is Flexible ? child.flex : 0;
310 final fit = child is Flexible ? child.fit : FlexFit.loose; 310 final fit = child is Flexible ? child.fit : FlexFit.loose;
311 if (flex > 0) { 311 if (flex > 0) {
@@ -162,7 +162,7 @@ class GridView extends MultiChildWidget with SpanningWidget { @@ -162,7 +162,7 @@ class GridView extends MultiChildWidget with SpanningWidget {
162 var c = 0; 162 var c = 0;
163 _context.lastChild = _context.firstChild; 163 _context.lastChild = _context.firstChild;
164 164
165 - for (var child in children.sublist( 165 + for (final child in children.sublist(
166 _context.firstChild, 166 _context.firstChild,
167 math.min(children.length, 167 math.min(children.length,
168 _context.firstChild + crossAxisCount * _mainAxisCount!))) { 168 _context.firstChild + crossAxisCount * _mainAxisCount!))) {
@@ -368,7 +368,7 @@ class MultiPage extends Page { @@ -368,7 +368,7 @@ class MultiPage extends Page {
368 final pageWidthMargin = _mustRotate ? _margin.vertical : _margin.horizontal; 368 final pageWidthMargin = _mustRotate ? _margin.vertical : _margin.horizontal;
369 final availableWidth = pageWidth - pageWidthMargin; 369 final availableWidth = pageWidth - pageWidthMargin;
370 370
371 - for (var page in _pages) { 371 + for (final page in _pages) {
372 var offsetStart = pageHeight - 372 var offsetStart = pageHeight -
373 (_mustRotate ? pageHeightMargin - _margin.bottom : _margin.top); 373 (_mustRotate ? pageHeightMargin - _margin.bottom : _margin.top);
374 var offsetEnd = 374 var offsetEnd =
@@ -386,7 +386,7 @@ class MultiPage extends Page { @@ -386,7 +386,7 @@ class MultiPage extends Page {
386 var totalFlex = 0; 386 var totalFlex = 0;
387 var allocatedSize = 0.0; 387 var allocatedSize = 0.0;
388 Widget? lastFlexChild; 388 Widget? lastFlexChild;
389 - for (var widget in page.widgets) { 389 + for (final widget in page.widgets) {
390 final child = widget.child; 390 final child = widget.child;
391 final flex = child is Flexible ? child.flex : 0; 391 final flex = child is Flexible ? child.flex : 0;
392 if (flex > 0) { 392 if (flex > 0) {
@@ -467,7 +467,7 @@ class MultiPage extends Page { @@ -467,7 +467,7 @@ class MultiPage extends Page {
467 } 467 }
468 } 468 }
469 469
470 - for (var widget in page.widgets) { 470 + for (final widget in page.widgets) {
471 final child = widget.child; 471 final child = widget.child;
472 472
473 final flex = child is Flexible ? child.flex : 0; 473 final flex = child is Flexible ? child.flex : 0;
@@ -505,7 +505,7 @@ class MultiPage extends Page { @@ -505,7 +505,7 @@ class MultiPage extends Page {
505 } 505 }
506 506
507 var pos = offsetStart - leadingSpace; 507 var pos = offsetStart - leadingSpace;
508 - for (var widget in page.widgets) { 508 + for (final widget in page.widgets) {
509 pos -= widget.child.box!.height; 509 pos -= widget.child.box!.height;
510 late double x; 510 late double x;
511 switch (crossAxisAlignment) { 511 switch (crossAxisAlignment) {
@@ -135,7 +135,7 @@ class Partitions extends Widget with SpanningWidget { @@ -135,7 +135,7 @@ class Partitions extends Widget with SpanningWidget {
135 135
136 // Calculate fixed width columns 136 // Calculate fixed width columns
137 var index = 0; 137 var index = 0;
138 - for (var child in children) { 138 + for (final child in children) {
139 if (child.flex > 0) { 139 if (child.flex > 0) {
140 assert(() { 140 assert(() {
141 if (!canFlex) { 141 if (!canFlex) {
@@ -160,7 +160,7 @@ class Partitions extends Widget with SpanningWidget { @@ -160,7 +160,7 @@ class Partitions extends Widget with SpanningWidget {
160 final spacePerFlex = freeSpace / totalFlex; 160 final spacePerFlex = freeSpace / totalFlex;
161 161
162 index = 0; 162 index = 0;
163 - for (var child in children) { 163 + for (final child in children) {
164 if (child.flex > 0) { 164 if (child.flex > 0) {
165 final childExtent = spacePerFlex * child.flex; 165 final childExtent = spacePerFlex * child.flex;
166 allocatedSize += childExtent; 166 allocatedSize += childExtent;
@@ -173,7 +173,7 @@ class Partitions extends Widget with SpanningWidget { @@ -173,7 +173,7 @@ class Partitions extends Widget with SpanningWidget {
173 // Layout the columns and compute the total height 173 // Layout the columns and compute the total height
174 var totalHeight = 0.0; 174 var totalHeight = 0.0;
175 index = 0; 175 index = 0;
176 - for (var child in children) { 176 + for (final child in children) {
177 if (widths[index]! > 0) { 177 if (widths[index]! > 0) {
178 final innerConstraints = BoxConstraints( 178 final innerConstraints = BoxConstraints(
179 minWidth: widths[index]!, 179 minWidth: widths[index]!,
@@ -190,7 +190,7 @@ class Partitions extends Widget with SpanningWidget { @@ -190,7 +190,7 @@ class Partitions extends Widget with SpanningWidget {
190 // Update Y positions 190 // Update Y positions
191 index = 0; 191 index = 0;
192 allocatedSize = 0.0; 192 allocatedSize = 0.0;
193 - for (var child in children) { 193 + for (final child in children) {
194 if (widths[index]! > 0) { 194 if (widths[index]! > 0) {
195 final offsetY = totalHeight - child.box!.height; 195 final offsetY = totalHeight - child.box!.height;
196 child.box = PdfRect.fromPoints( 196 child.box = PdfRect.fromPoints(
@@ -213,7 +213,7 @@ class Partitions extends Widget with SpanningWidget { @@ -213,7 +213,7 @@ class Partitions extends Widget with SpanningWidget {
213 context.canvas 213 context.canvas
214 ..saveContext() 214 ..saveContext()
215 ..setTransform(mat); 215 ..setTransform(mat);
216 - for (var child in children) { 216 + for (final child in children) {
217 child.paint(context); 217 child.paint(context);
218 } 218 }
219 context.canvas.restoreContext(); 219 context.canvas.restoreContext();
@@ -147,7 +147,7 @@ class Stack extends MultiChildWidget { @@ -147,7 +147,7 @@ class Stack extends MultiChildWidget {
147 break; 147 break;
148 } 148 }
149 149
150 - for (var child in children) { 150 + for (final child in children) {
151 if (child is! Positioned) { 151 if (child is! Positioned) {
152 hasNonPositionedChildren = true; 152 hasNonPositionedChildren = true;
153 153
@@ -168,7 +168,7 @@ class Stack extends MultiChildWidget { @@ -168,7 +168,7 @@ class Stack extends MultiChildWidget {
168 box = PdfRect.fromPoints(PdfPoint.zero, constraints.biggest); 168 box = PdfRect.fromPoints(PdfPoint.zero, constraints.biggest);
169 } 169 }
170 170
171 - for (var child in children) { 171 + for (final child in children) {
172 if (child is! Positioned) { 172 if (child is! Positioned) {
173 child.box = PdfRect.fromPoints( 173 child.box = PdfRect.fromPoints(
174 alignment.inscribe(child.box!.size, box!).offset, child.box!.size); 174 alignment.inscribe(child.box!.size, box!).offset, child.box!.size);
@@ -232,7 +232,7 @@ class Stack extends MultiChildWidget { @@ -232,7 +232,7 @@ class Stack extends MultiChildWidget {
232 ..drawRect(0, 0, box!.width, box!.height) 232 ..drawRect(0, 0, box!.width, box!.height)
233 ..clipPath(); 233 ..clipPath();
234 } 234 }
235 - for (var child in children) { 235 + for (final child in children) {
236 child.paint(context); 236 child.paint(context);
237 } 237 }
238 context.canvas.restoreContext(); 238 context.canvas.restoreContext();
@@ -108,7 +108,7 @@ class TableBorder extends Border { @@ -108,7 +108,7 @@ class TableBorder extends Border {
108 if (verticalInside.style.paint) { 108 if (verticalInside.style.paint) {
109 verticalInside.style.setStyle(context); 109 verticalInside.style.setStyle(context);
110 var offset = box.x; 110 var offset = box.x;
111 - for (var width in widths!.sublist(0, widths.length - 1)) { 111 + for (final width in widths!.sublist(0, widths.length - 1)) {
112 offset += width!; 112 offset += width!;
113 context.canvas.moveTo(offset, box.y); 113 context.canvas.moveTo(offset, box.y);
114 context.canvas.lineTo(offset, box.top); 114 context.canvas.lineTo(offset, box.top);
@@ -123,7 +123,7 @@ class TableBorder extends Border { @@ -123,7 +123,7 @@ class TableBorder extends Border {
123 if (horizontalInside.style.paint) { 123 if (horizontalInside.style.paint) {
124 horizontalInside.style.setStyle(context); 124 horizontalInside.style.setStyle(context);
125 var offset = box.top; 125 var offset = box.top;
126 - for (var height in heights!.sublist(0, heights.length - 1)) { 126 + for (final height in heights!.sublist(0, heights.length - 1)) {
127 offset -= height; 127 offset -= height;
128 context.canvas.moveTo(box.x, offset); 128 context.canvas.moveTo(box.x, offset);
129 context.canvas.lineTo(box.right, offset); 129 context.canvas.lineTo(box.right, offset);
@@ -437,9 +437,9 @@ class Table extends Widget with SpanningWidget { @@ -437,9 +437,9 @@ class Table extends Widget with SpanningWidget {
437 _heights.clear(); 437 _heights.clear();
438 var index = 0; 438 var index = 0;
439 439
440 - for (var row in children) { 440 + for (final row in children) {
441 var n = 0; 441 var n = 0;
442 - for (var child in row.children) { 442 + for (final child in row.children) {
443 final columnWidth = columnWidths != null && columnWidths![n] != null 443 final columnWidth = columnWidths != null && columnWidths![n] != null
444 ? columnWidths![n]! 444 ? columnWidths![n]!
445 : defaultColumnWidth; 445 : defaultColumnWidth;
@@ -495,7 +495,7 @@ class Table extends Widget with SpanningWidget { @@ -495,7 +495,7 @@ class Table extends Widget with SpanningWidget {
495 // Compute final widths 495 // Compute final widths
496 var totalHeight = 0.0; 496 var totalHeight = 0.0;
497 index = 0; 497 index = 0;
498 - for (var row in children) { 498 + for (final row in children) {
499 if (index++ < _context.firstLine && !row.repeat) { 499 if (index++ < _context.firstLine && !row.repeat) {
500 continue; 500 continue;
501 } 501 }
@@ -504,7 +504,7 @@ class Table extends Widget with SpanningWidget { @@ -504,7 +504,7 @@ class Table extends Widget with SpanningWidget {
504 var x = 0.0; 504 var x = 0.0;
505 505
506 var lineHeight = 0.0; 506 var lineHeight = 0.0;
507 - for (var child in row.children) { 507 + for (final child in row.children) {
508 final childConstraints = BoxConstraints.tightFor(width: _widths[n]); 508 final childConstraints = BoxConstraints.tightFor(width: _widths[n]);
509 child.layout(context, childConstraints); 509 child.layout(context, childConstraints);
510 assert(child.box != null); 510 assert(child.box != null);
@@ -521,7 +521,7 @@ class Table extends Widget with SpanningWidget { @@ -521,7 +521,7 @@ class Table extends Widget with SpanningWidget {
521 // Compute the layout again to give the full height to all cells 521 // Compute the layout again to give the full height to all cells
522 n = 0; 522 n = 0;
523 x = 0; 523 x = 0;
524 - for (var child in row.children) { 524 + for (final child in row.children) {
525 final childConstraints = 525 final childConstraints =
526 BoxConstraints.tightFor(width: _widths[n], height: lineHeight); 526 BoxConstraints.tightFor(width: _widths[n], height: lineHeight);
527 child.layout(context, childConstraints); 527 child.layout(context, childConstraints);
@@ -545,14 +545,14 @@ class Table extends Widget with SpanningWidget { @@ -545,14 +545,14 @@ class Table extends Widget with SpanningWidget {
545 // Compute final y position 545 // Compute final y position
546 index = 0; 546 index = 0;
547 var heightIndex = 0; 547 var heightIndex = 0;
548 - for (var row in children) { 548 + for (final row in children) {
549 if (index++ < _context.firstLine && !row.repeat) { 549 if (index++ < _context.firstLine && !row.repeat) {
550 continue; 550 continue;
551 } 551 }
552 552
553 final align = row.verticalAlignment ?? defaultVerticalAlignment; 553 final align = row.verticalAlignment ?? defaultVerticalAlignment;
554 554
555 - for (var child in row.children) { 555 + for (final child in row.children) {
556 double? childY; 556 double? childY;
557 557
558 switch (align) { 558 switch (align) {
@@ -602,7 +602,7 @@ class Table extends Widget with SpanningWidget { @@ -602,7 +602,7 @@ class Table extends Widget with SpanningWidget {
602 ..setTransform(mat); 602 ..setTransform(mat);
603 603
604 var index = 0; 604 var index = 0;
605 - for (var row in children) { 605 + for (final row in children) {
606 if (index++ < _context.firstLine && !row.repeat) { 606 if (index++ < _context.firstLine && !row.repeat) {
607 continue; 607 continue;
608 } 608 }
@@ -610,7 +610,7 @@ class Table extends Widget with SpanningWidget { @@ -610,7 +610,7 @@ class Table extends Widget with SpanningWidget {
610 if (row.decoration != null) { 610 if (row.decoration != null) {
611 var y = double.infinity; 611 var y = double.infinity;
612 var h = 0.0; 612 var h = 0.0;
613 - for (var child in row.children) { 613 + for (final child in row.children) {
614 y = math.min(y, child.box!.y); 614 y = math.min(y, child.box!.y);
615 h = math.max(h, child.box!.height); 615 h = math.max(h, child.box!.height);
616 } 616 }
@@ -621,7 +621,7 @@ class Table extends Widget with SpanningWidget { @@ -621,7 +621,7 @@ class Table extends Widget with SpanningWidget {
621 ); 621 );
622 } 622 }
623 623
624 - for (var child in row.children) { 624 + for (final child in row.children) {
625 context.canvas 625 context.canvas
626 ..saveContext() 626 ..saveContext()
627 ..drawRect( 627 ..drawRect(
@@ -636,7 +636,7 @@ class Table extends Widget with SpanningWidget { @@ -636,7 +636,7 @@ class Table extends Widget with SpanningWidget {
636 } 636 }
637 637
638 index = 0; 638 index = 0;
639 - for (var row in children) { 639 + for (final row in children) {
640 if (index++ < _context.firstLine && !row.repeat) { 640 if (index++ < _context.firstLine && !row.repeat) {
641 continue; 641 continue;
642 } 642 }
@@ -644,7 +644,7 @@ class Table extends Widget with SpanningWidget { @@ -644,7 +644,7 @@ class Table extends Widget with SpanningWidget {
644 if (row.decoration != null) { 644 if (row.decoration != null) {
645 var y = double.infinity; 645 var y = double.infinity;
646 var h = 0.0; 646 var h = 0.0;
647 - for (var child in row.children) { 647 + for (final child in row.children) {
648 y = math.min(y, child.box!.y); 648 y = math.min(y, child.box!.y);
649 h = math.max(h, child.box!.height); 649 h = math.max(h, child.box!.height);
650 } 650 }
@@ -458,16 +458,16 @@ class TextSpan extends InlineSpan { @@ -458,16 +458,16 @@ class TextSpan extends InlineSpan {
458 AnnotationBuilder? annotation, 458 AnnotationBuilder? annotation,
459 ) { 459 ) {
460 final _style = parentStyle?.merge(style); 460 final _style = parentStyle?.merge(style);
461 - final _a = this.annotation ?? annotation; 461 + final _annotation = this.annotation ?? annotation;
462 462
463 if (text != null) { 463 if (text != null) {
464 - if (!visitor(this, _style, _a)) { 464 + if (!visitor(this, _style, _annotation)) {
465 return false; 465 return false;
466 } 466 }
467 } 467 }
468 if (children != null) { 468 if (children != null) {
469 - for (var child in children!) {  
470 - if (!child.visitChildren(visitor, _style, _a)) { 469 + for (final child in children!) {
  470 + if (!child.visitChildren(visitor, _style, _annotation)) {
471 return false; 471 return false;
472 } 472 }
473 } 473 }
@@ -534,7 +534,7 @@ class _Line { @@ -534,7 +534,7 @@ class _Line {
534 } 534 }
535 delta = (totalWidth - wordsWidth) / (spans.length - 1); 535 delta = (totalWidth - wordsWidth) / (spans.length - 1);
536 var x = 0.0; 536 var x = 0.0;
537 - for (var span in spans) { 537 + for (final span in spans) {
538 span.offset = span.offset.translate(x, -baseline); 538 span.offset = span.offset.translate(x, -baseline);
539 x += delta; 539 x += delta;
540 } 540 }
@@ -542,7 +542,7 @@ class _Line { @@ -542,7 +542,7 @@ class _Line {
542 } 542 }
543 543
544 if (textDirection == TextDirection.rtl) { 544 if (textDirection == TextDirection.rtl) {
545 - for (var span in spans) { 545 + for (final span in spans) {
546 span.offset = PdfPoint( 546 span.offset = PdfPoint(
547 totalWidth - (span.offset.x + span.width) - delta, 547 totalWidth - (span.offset.x + span.width) - delta,
548 span.offset.y - baseline, 548 span.offset.y - baseline,
@@ -552,7 +552,7 @@ class _Line { @@ -552,7 +552,7 @@ class _Line {
552 return; 552 return;
553 } 553 }
554 554
555 - for (var span in spans) { 555 + for (final span in spans) {
556 span.offset = span.offset.translate(delta, -baseline); 556 span.offset = span.offset.translate(delta, -baseline);
557 } 557 }
558 558
@@ -978,7 +978,7 @@ class RichText extends Widget with SpanningWidget { @@ -978,7 +978,7 @@ class RichText extends Widget with SpanningWidget {
978 ..clipPath(); 978 ..clipPath();
979 } 979 }
980 980
981 - for (var decoration in _decorations) { 981 + for (final decoration in _decorations) {
982 assert(() { 982 assert(() {
983 if (Document.debug && RichText.debug) { 983 if (Document.debug && RichText.debug) {
984 decoration.debugPaint(context, textScaleFactor, box!, _spans); 984 decoration.debugPaint(context, textScaleFactor, box!, _spans);
@@ -994,7 +994,7 @@ class RichText extends Widget with SpanningWidget { @@ -994,7 +994,7 @@ class RichText extends Widget with SpanningWidget {
994 ); 994 );
995 } 995 }
996 996
997 - for (var span in _spans.sublist(_context.spanStart, _context.spanEnd)) { 997 + for (final span in _spans.sublist(_context.spanStart, _context.spanEnd)) {
998 assert(() { 998 assert(() {
999 if (Document.debug && RichText.debug) { 999 if (Document.debug && RichText.debug) {
1000 span.debugPaint(context, textScaleFactor, box); 1000 span.debugPaint(context, textScaleFactor, box);
@@ -1018,7 +1018,7 @@ class RichText extends Widget with SpanningWidget { @@ -1018,7 +1018,7 @@ class RichText extends Widget with SpanningWidget {
1018 ); 1018 );
1019 } 1019 }
1020 1020
1021 - for (var decoration in _decorations) { 1021 + for (final decoration in _decorations) {
1022 decoration.foregroundPaint( 1022 decoration.foregroundPaint(
1023 context, 1023 context,
1024 textScaleFactor, 1024 textScaleFactor,
@@ -35,7 +35,7 @@ class TextDecoration { @@ -35,7 +35,7 @@ class TextDecoration {
35 /// Creates a decoration that paints the union of all the given decorations. 35 /// Creates a decoration that paints the union of all the given decorations.
36 factory TextDecoration.combine(List<TextDecoration> decorations) { 36 factory TextDecoration.combine(List<TextDecoration> decorations) {
37 var mask = 0; 37 var mask = 0;
38 - for (var decoration in decorations) { 38 + for (final decoration in decorations) {
39 mask |= decoration._mask; 39 mask |= decoration._mask;
40 } 40 }
41 return TextDecoration._(mask); 41 return TextDecoration._(mask);
@@ -192,7 +192,7 @@ class Wrap extends MultiChildWidget with SpanningWidget { @@ -192,7 +192,7 @@ class Wrap extends MultiChildWidget with SpanningWidget {
192 var runCrossAxisExtent = 0.0; 192 var runCrossAxisExtent = 0.0;
193 var childCount = 0; 193 var childCount = 0;
194 194
195 - for (var child in children.sublist(_context.firstChild)) { 195 + for (final child in children.sublist(_context.firstChild)) {
196 child.layout(context, childConstraints, parentUsesSize: true); 196 child.layout(context, childConstraints, parentUsesSize: true);
197 197
198 final childMainAxisExtent = _getMainAxisExtent(child)!; 198 final childMainAxisExtent = _getMainAxisExtent(child)!;
@@ -339,7 +339,7 @@ class Wrap extends MultiChildWidget with SpanningWidget { @@ -339,7 +339,7 @@ class Wrap extends MultiChildWidget with SpanningWidget {
339 } 339 }
340 340
341 var currentWidget = _context.lastChild; 341 var currentWidget = _context.lastChild;
342 - for (var child in children.sublist(currentWidget)) { 342 + for (final child in children.sublist(currentWidget)) {
343 final runIndex = childRunMetrics[child]; 343 final runIndex = childRunMetrics[child];
344 if (runIndex != i) { 344 if (runIndex != i) {
345 break; 345 break;
@@ -460,7 +460,7 @@ void main() { @@ -460,7 +460,7 @@ void main() {
460 ), 460 ),
461 ); 461 );
462 462
463 - for (var item in cases) { 463 + for (final item in cases) {
464 expect( 464 expect(
465 arabic.convert(item.original).codeUnits, 465 arabic.convert(item.original).codeUnits,
466 equals(item.reshaped), 466 equals(item.reshaped),
@@ -107,7 +107,7 @@ void main() { @@ -107,7 +107,7 @@ void main() {
107 final fontData = ttfFont.readAsBytesSync(); 107 final fontData = ttfFont.readAsBytesSync();
108 final font = PdfTtfFont(pdf.document, fontData.buffer.asByteData()); 108 final font = PdfTtfFont(pdf.document, fontData.buffer.asByteData());
109 109
110 - for (var letter in 110 + for (final letter in
111 //font.font.charToGlyphIndexMap.keys 111 //font.font.charToGlyphIndexMap.keys
112 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz&%!?0123456789' 112 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz&%!?0123456789'
113 .codeUnits) { 113 .codeUnits) {
@@ -54,8 +54,8 @@ void main() { @@ -54,8 +54,8 @@ void main() {
54 final image = generateBitmap(100, 200); 54 final image = generateBitmap(100, 200);
55 55
56 final widgets = <Widget>[]; 56 final widgets = <Widget>[];
57 - for (var shape in BoxShape.values) {  
58 - for (var fit in BoxFit.values) { 57 + for (final shape in BoxShape.values) {
  58 + for (final fit in BoxFit.values) {
59 widgets.add( 59 widgets.add(
60 Container( 60 Container(
61 alignment: Alignment.center, 61 alignment: Alignment.center,
@@ -30,7 +30,7 @@ List<TableRow> buildTable( @@ -30,7 +30,7 @@ List<TableRow> buildTable(
30 final rows = <TableRow>[]; 30 final rows = <TableRow>[];
31 { 31 {
32 final tableRow = <Widget>[]; 32 final tableRow = <Widget>[];
33 - for (var cell in <String>['Hue', 'Color', 'RGBA']) { 33 + for (final cell in <String>['Hue', 'Color', 'RGBA']) {
34 tableRow.add(Container( 34 tableRow.add(Container(
35 alignment: Alignment.center, 35 alignment: Alignment.center,
36 margin: const EdgeInsets.all(5), 36 margin: const EdgeInsets.all(5),
@@ -32,7 +32,7 @@ Iterable<TextDecoration> permute( @@ -32,7 +32,7 @@ Iterable<TextDecoration> permute(
32 List<TextDecoration> prefix, List<TextDecoration> remaining) sync* { 32 List<TextDecoration> prefix, List<TextDecoration> remaining) sync* {
33 yield TextDecoration.combine(prefix); 33 yield TextDecoration.combine(prefix);
34 if (remaining.isNotEmpty) { 34 if (remaining.isNotEmpty) {
35 - for (var decoration in remaining) { 35 + for (final decoration in remaining) {
36 final next = List<TextDecoration>.from(remaining); 36 final next = List<TextDecoration>.from(remaining);
37 next.remove(decoration); 37 next.remove(decoration);
38 yield* permute(prefix + <TextDecoration>[decoration], next); 38 yield* permute(prefix + <TextDecoration>[decoration], next);
@@ -99,7 +99,7 @@ void main() { @@ -99,7 +99,7 @@ void main() {
99 final para = LoremText().paragraph(40); 99 final para = LoremText().paragraph(40);
100 100
101 final widgets = <Widget>[]; 101 final widgets = <Widget>[];
102 - for (var align in TextAlign.values) { 102 + for (final align in TextAlign.values) {
103 widgets.add( 103 widgets.add(
104 Text( 104 Text(
105 '$align:\n' + para, 105 '$align:\n' + para,
@@ -191,8 +191,8 @@ void main() { @@ -191,8 +191,8 @@ void main() {
191 ), 191 ),
192 ); 192 );
193 193
194 - for (var decorationStyle in TextDecorationStyle.values) {  
195 - for (var decoration in decorationSet) { 194 + for (final decorationStyle in TextDecorationStyle.values) {
  195 + for (final decoration in decorationSet) {
196 widgets.add( 196 widgets.add(
197 Text( 197 Text(
198 decoration.toString().replaceAll('.', ' '), 198 decoration.toString().replaceAll('.', ' '),
@@ -217,7 +217,7 @@ void main() { @@ -217,7 +217,7 @@ void main() {
217 final para = LoremText(random: rnd).paragraph(40); 217 final para = LoremText(random: rnd).paragraph(40);
218 218
219 final spans = <TextSpan>[]; 219 final spans = <TextSpan>[];
220 - for (var word in para.split(' ')) { 220 + for (final word in para.split(' ')) {
221 spans.add( 221 spans.add(
222 TextSpan( 222 TextSpan(
223 text: word, 223 text: word,
@@ -31,9 +31,9 @@ void main() { @@ -31,9 +31,9 @@ void main() {
31 31
32 test('Wrap Widget Horizontal 1', () { 32 test('Wrap Widget Horizontal 1', () {
33 final wraps = <Widget>[]; 33 final wraps = <Widget>[];
34 - for (var direction in VerticalDirection.values) { 34 + for (final direction in VerticalDirection.values) {
35 wraps.add(Text('$direction')); 35 wraps.add(Text('$direction'));
36 - for (var alignment in WrapAlignment.values) { 36 + for (final alignment in WrapAlignment.values) {
37 wraps.add(Text('$alignment')); 37 wraps.add(Text('$alignment'));
38 wraps.add( 38 wraps.add(
39 Wrap( 39 Wrap(
@@ -63,9 +63,9 @@ void main() { @@ -63,9 +63,9 @@ void main() {
63 63
64 test('Wrap Widget Vertical 1', () { 64 test('Wrap Widget Vertical 1', () {
65 final wraps = <Widget>[]; 65 final wraps = <Widget>[];
66 - for (var direction in VerticalDirection.values) { 66 + for (final direction in VerticalDirection.values) {
67 wraps.add(Transform.rotateBox(child: Text('$direction'), angle: 1.57)); 67 wraps.add(Transform.rotateBox(child: Text('$direction'), angle: 1.57));
68 - for (var alignment in WrapAlignment.values) { 68 + for (final alignment in WrapAlignment.values) {
69 wraps.add(Transform.rotateBox(child: Text('$alignment'), angle: 1.57)); 69 wraps.add(Transform.rotateBox(child: Text('$alignment'), angle: 1.57));
70 wraps.add( 70 wraps.add(
71 Wrap( 71 Wrap(
@@ -95,7 +95,7 @@ void main() { @@ -95,7 +95,7 @@ void main() {
95 95
96 test('Wrap Widget Horizontal 2', () { 96 test('Wrap Widget Horizontal 2', () {
97 final wraps = <Widget>[]; 97 final wraps = <Widget>[];
98 - for (var alignment in WrapCrossAlignment.values) { 98 + for (final alignment in WrapCrossAlignment.values) {
99 final rnd = math.Random(42); 99 final rnd = math.Random(42);
100 wraps.add(Text('$alignment')); 100 wraps.add(Text('$alignment'));
101 wraps.add( 101 wraps.add(
@@ -129,7 +129,7 @@ void main() { @@ -129,7 +129,7 @@ void main() {
129 129
130 test('Wrap Widget Vertical 2', () { 130 test('Wrap Widget Vertical 2', () {
131 final wraps = <Widget>[]; 131 final wraps = <Widget>[];
132 - for (var alignment in WrapCrossAlignment.values) { 132 + for (final alignment in WrapCrossAlignment.values) {
133 final rnd = math.Random(42); 133 final rnd = math.Random(42);
134 wraps.add(Transform.rotateBox(child: Text('$alignment'), angle: 1.57)); 134 wraps.add(Transform.rotateBox(child: Text('$alignment'), angle: 1.57));
135 wraps.add( 135 wraps.add(
@@ -163,7 +163,7 @@ void main() { @@ -163,7 +163,7 @@ void main() {
163 163
164 test('Wrap Widget Horizontal 3', () { 164 test('Wrap Widget Horizontal 3', () {
165 final wraps = <Widget>[]; 165 final wraps = <Widget>[];
166 - for (var alignment in WrapAlignment.values) { 166 + for (final alignment in WrapAlignment.values) {
167 final rnd = math.Random(42); 167 final rnd = math.Random(42);
168 wraps.add(Text('$alignment')); 168 wraps.add(Text('$alignment'));
169 wraps.add( 169 wraps.add(
@@ -199,7 +199,7 @@ void main() { @@ -199,7 +199,7 @@ void main() {
199 199
200 test('Wrap Widget Vertical 3', () { 200 test('Wrap Widget Vertical 3', () {
201 final wraps = <Widget>[]; 201 final wraps = <Widget>[];
202 - for (var alignment in WrapAlignment.values) { 202 + for (final alignment in WrapAlignment.values) {
203 final rnd = math.Random(42); 203 final rnd = math.Random(42);
204 wraps.add(Transform.rotateBox(child: Text('$alignment'), angle: 1.57)); 204 wraps.add(Transform.rotateBox(child: Text('$alignment'), angle: 1.57));
205 wraps.add( 205 wraps.add(