@@ -1054,9 +1054,7 @@ class TupleClass<T extends List> extends ConstructType<List> {
1054
1054
// `>=` because tuples can be covariant when encoded.
1055
1055
return x.length >= _fields.length &&
1056
1056
_components
1057
- .asMap ()
1058
- .entries
1059
- .map ((t) => t.value.covariant (x[t.key]) ? 0 : 1 )
1057
+ .mapIndexed ((index, value) => value.covariant (x[index]) ? 0 : 1 )
1060
1058
.reduce ((value, element) => value + element) ==
1061
1059
0 ;
1062
1060
}
@@ -1103,10 +1101,7 @@ class TupleClass<T extends List> extends ConstructType<List> {
1103
1101
);
1104
1102
}
1105
1103
final res = [];
1106
- for (final entry in tuple._components.asMap ().entries) {
1107
- // [i, wireType]
1108
- final i = entry.key;
1109
- final wireType = entry.value;
1104
+ for (final (i, wireType) in tuple._components.indexed) {
1110
1105
if (i >= _components.length) {
1111
1106
// skip value
1112
1107
wireType.decodeValue (x, wireType);
@@ -1406,7 +1401,7 @@ class FuncClass extends ConstructType<List> {
1406
1401
'Arity mismatch' ,
1407
1402
);
1408
1403
}
1409
- return '(${types .asMap (). entries . map (( e ) => e .value . valueToString (v [e . key ])).join (', ' )})' ;
1404
+ return '(${types .mapIndexed (( i , e ) => e .valueToString (v [i ])).join (', ' )})' ;
1410
1405
}
1411
1406
1412
1407
@override
@@ -1866,22 +1861,21 @@ List idlDecode(List<CType> retTypes, Uint8List bytes) {
1866
1861
}
1867
1862
}
1868
1863
1869
- rawTable. asMap (). forEach (( i, entry ) {
1870
- final t = buildType (entry );
1864
+ for ( final ( i, e) in rawTable.indexed ) {
1865
+ final t = buildType (e );
1871
1866
table[i].fill (t);
1872
- });
1867
+ }
1873
1868
1874
1869
final types = rawTypes.map ((t) => getType (t)).toList ();
1875
1870
1876
- final output = retTypes.asMap ().entries.map ((entry) {
1877
- final result = entry.value.decodeValue (b, types[entry.key]);
1878
- return result;
1879
- }).toList ();
1871
+ final output =
1872
+ retTypes.mapIndexed ((i, e) => e.decodeValue (b, types[i])).toList ();
1880
1873
1881
1874
// Skip unused values.
1882
1875
for (int ind = retTypes.length; ind < types.length; ind++ ) {
1883
1876
types[ind].decodeValue (b, types[ind]);
1884
1877
}
1878
+
1885
1879
if (b.buffer.isNotEmpty) {
1886
1880
throw StateError ('Unexpected left-over bytes.' );
1887
1881
}
0 commit comments