@@ -445,12 +445,12 @@ class Endian {
445
445
* Finally, `ByteData` may be used to intentionally reinterpret the bytes
446
446
* representing one arithmetic type as another.
447
447
* For example this code fragment determine what 32-bit signed integer
448
- * is represented by the bytes of a 32-bit floating point number:
448
+ * is represented by the bytes of a 32-bit floating point number
449
+ * (both stored as big endian):
449
450
*
450
- * var buffer = new Uint8List(8).buffer;
451
- * var bdata = new ByteData.view(buffer);
451
+ * var bdata = new ByteData(8);
452
452
* bdata.setFloat32(0, 3.04);
453
- * int huh = bdata.getInt32(0);
453
+ * int huh = bdata.getInt32(0); // 0x40428f5c
454
454
*/
455
455
abstract class ByteData implements TypedData {
456
456
/**
@@ -787,6 +787,8 @@ abstract class Int8List implements List<int>, _TypedIntList {
787
787
/**
788
788
* Creates an [Int8List] of the specified length (in elements), all of
789
789
* whose elements are initially zero.
790
+ *
791
+ * The list is backed by a [ByteBuffer] containing precisely [length] bytes.
790
792
*/
791
793
external factory Int8List (int length);
792
794
@@ -796,6 +798,9 @@ abstract class Int8List implements List<int>, _TypedIntList {
796
798
*
797
799
* Values are truncated to fit in the list when they are copied,
798
800
* the same way storing values truncates them.
801
+ *
802
+ * The list is backed by a [ByteBuffer] containing precisely `elements.length`
803
+ * bytes.
799
804
*/
800
805
external factory Int8List .fromList (List <int > elements);
801
806
@@ -904,6 +909,8 @@ abstract class Uint8List implements List<int>, _TypedIntList {
904
909
/**
905
910
* Creates a [Uint8List] of the specified length (in elements), all of
906
911
* whose elements are initially zero.
912
+ *
913
+ * The list is backed by a [ByteBuffer] containing precisely [length] bytes.
907
914
*/
908
915
external factory Uint8List (int length);
909
916
@@ -913,6 +920,9 @@ abstract class Uint8List implements List<int>, _TypedIntList {
913
920
*
914
921
* Values are truncated to fit in the list when they are copied,
915
922
* the same way storing values truncates them.
923
+ *
924
+ * The list is backed by a [ByteBuffer] containing precisely `elements.length`
925
+ * bytes.
916
926
*/
917
927
external factory Uint8List .fromList (List <int > elements);
918
928
@@ -1030,6 +1040,8 @@ abstract class Uint8ClampedList implements List<int>, _TypedIntList {
1030
1040
/**
1031
1041
* Creates a [Uint8ClampedList] of the specified length (in elements), all of
1032
1042
* whose elements are initially zero.
1043
+ *
1044
+ * The list is backed by a [ByteBuffer] containing precisely [length] bytes.
1033
1045
*/
1034
1046
external factory Uint8ClampedList (int length);
1035
1047
@@ -1039,6 +1051,9 @@ abstract class Uint8ClampedList implements List<int>, _TypedIntList {
1039
1051
*
1040
1052
* Values are clamped to fit in the list when they are copied,
1041
1053
* the same way storing values clamps them.
1054
+ *
1055
+ * The list is backed by a [ByteBuffer] containing precisely `elements.length`
1056
+ * bytes.
1042
1057
*/
1043
1058
external factory Uint8ClampedList .fromList (List <int > elements);
1044
1059
@@ -1150,6 +1165,9 @@ abstract class Int16List implements List<int>, _TypedIntList {
1150
1165
/**
1151
1166
* Creates an [Int16List] of the specified length (in elements), all of
1152
1167
* whose elements are initially zero.
1168
+ *
1169
+ * The list is backed by a [ByteBuffer] containing precisely
1170
+ * [length] times 2 bytes.
1153
1171
*/
1154
1172
external factory Int16List (int length);
1155
1173
@@ -1159,6 +1177,9 @@ abstract class Int16List implements List<int>, _TypedIntList {
1159
1177
*
1160
1178
* Values are truncated to fit in the list when they are copied,
1161
1179
* the same way storing values truncates them.
1180
+ *
1181
+ * The list is backed by a [ByteBuffer] containing precisely
1182
+ * `elements.length` times 2 bytes.
1162
1183
*/
1163
1184
external factory Int16List .fromList (List <int > elements);
1164
1185
@@ -1279,6 +1300,9 @@ abstract class Uint16List implements List<int>, _TypedIntList {
1279
1300
/**
1280
1301
* Creates a [Uint16List] of the specified length (in elements), all
1281
1302
* of whose elements are initially zero.
1303
+ *
1304
+ * The list is backed by a [ByteBuffer] containing precisely
1305
+ * [length] times 2 bytes.
1282
1306
*/
1283
1307
external factory Uint16List (int length);
1284
1308
@@ -1288,6 +1312,9 @@ abstract class Uint16List implements List<int>, _TypedIntList {
1288
1312
*
1289
1313
* Values are truncated to fit in the list when they are copied,
1290
1314
* the same way storing values truncates them.
1315
+ *
1316
+ * The list is backed by a [ByteBuffer] containing precisely
1317
+ * `elements.length` times 2 bytes.
1291
1318
*/
1292
1319
external factory Uint16List .fromList (List <int > elements);
1293
1320
@@ -1409,6 +1436,9 @@ abstract class Int32List implements List<int>, _TypedIntList {
1409
1436
/**
1410
1437
* Creates an [Int32List] of the specified length (in elements), all of
1411
1438
* whose elements are initially zero.
1439
+ *
1440
+ * The list is backed by a [ByteBuffer] containing precisely
1441
+ * [length] times 4 bytes.
1412
1442
*/
1413
1443
external factory Int32List (int length);
1414
1444
@@ -1418,6 +1448,9 @@ abstract class Int32List implements List<int>, _TypedIntList {
1418
1448
*
1419
1449
* Values are truncated to fit in the list when they are copied,
1420
1450
* the same way storing values truncates them.
1451
+ *
1452
+ * The list is backed by a [ByteBuffer] containing precisely
1453
+ * `elements.length` times 4 bytes.
1421
1454
*/
1422
1455
external factory Int32List .fromList (List <int > elements);
1423
1456
@@ -1538,6 +1571,9 @@ abstract class Uint32List implements List<int>, _TypedIntList {
1538
1571
/**
1539
1572
* Creates a [Uint32List] of the specified length (in elements), all
1540
1573
* of whose elements are initially zero.
1574
+ *
1575
+ * The list is backed by a [ByteBuffer] containing precisely
1576
+ * [length] times 4 bytes.
1541
1577
*/
1542
1578
external factory Uint32List (int length);
1543
1579
@@ -1547,6 +1583,9 @@ abstract class Uint32List implements List<int>, _TypedIntList {
1547
1583
*
1548
1584
* Values are truncated to fit in the list when they are copied,
1549
1585
* the same way storing values truncates them.
1586
+ *
1587
+ * The list is backed by a [ByteBuffer] containing precisely
1588
+ * `elements.length` times 4 bytes.
1550
1589
*/
1551
1590
external factory Uint32List .fromList (List <int > elements);
1552
1591
@@ -1668,6 +1707,9 @@ abstract class Int64List implements List<int>, _TypedIntList {
1668
1707
/**
1669
1708
* Creates an [Int64List] of the specified length (in elements), all of
1670
1709
* whose elements are initially zero.
1710
+ *
1711
+ * The list is backed by a [ByteBuffer] containing precisely
1712
+ * [length] times 8 bytes.
1671
1713
*/
1672
1714
external factory Int64List (int length);
1673
1715
@@ -1677,6 +1719,9 @@ abstract class Int64List implements List<int>, _TypedIntList {
1677
1719
*
1678
1720
* Values are truncated to fit in the list when they are copied,
1679
1721
* the same way storing values truncates them.
1722
+ *
1723
+ * The list is backed by a [ByteBuffer] containing precisely
1724
+ * `elements.length` times 8 bytes.
1680
1725
*/
1681
1726
external factory Int64List .fromList (List <int > elements);
1682
1727
@@ -1797,6 +1842,9 @@ abstract class Uint64List implements List<int>, _TypedIntList {
1797
1842
/**
1798
1843
* Creates a [Uint64List] of the specified length (in elements), all
1799
1844
* of whose elements are initially zero.
1845
+ *
1846
+ * The list is backed by a [ByteBuffer] containing precisely
1847
+ * [length] times 8 bytes.
1800
1848
*/
1801
1849
external factory Uint64List (int length);
1802
1850
@@ -1806,6 +1854,9 @@ abstract class Uint64List implements List<int>, _TypedIntList {
1806
1854
*
1807
1855
* Values are truncated to fit in the list when they are copied,
1808
1856
* the same way storing values truncates them.
1857
+ *
1858
+ * The list is backed by a [ByteBuffer] containing precisely
1859
+ * `elements.length` times 8 bytes.
1809
1860
*/
1810
1861
external factory Uint64List .fromList (List <int > elements);
1811
1862
@@ -1928,6 +1979,9 @@ abstract class Float32List implements List<double>, _TypedFloatList {
1928
1979
/**
1929
1980
* Creates a [Float32List] of the specified length (in elements), all of
1930
1981
* whose elements are initially zero.
1982
+ *
1983
+ * The list is backed by a [ByteBuffer] containing precisely
1984
+ * [length] times 4 bytes.
1931
1985
*/
1932
1986
external factory Float32List (int length);
1933
1987
@@ -1937,6 +1991,9 @@ abstract class Float32List implements List<double>, _TypedFloatList {
1937
1991
*
1938
1992
* Values are truncated to fit in the list when they are copied,
1939
1993
* the same way storing values truncates them.
1994
+ *
1995
+ * The list is backed by a [ByteBuffer] containing precisely
1996
+ * `elements.length` times 4 bytes.
1940
1997
*/
1941
1998
external factory Float32List .fromList (List <double > elements);
1942
1999
@@ -2054,12 +2111,18 @@ abstract class Float64List implements List<double>, _TypedFloatList {
2054
2111
/**
2055
2112
* Creates a [Float64List] of the specified length (in elements), all of
2056
2113
* whose elements are initially zero.
2114
+ *
2115
+ * The list is backed by a [ByteBuffer] containing precisely
2116
+ * [length] times 8 bytes.
2057
2117
*/
2058
2118
external factory Float64List (int length);
2059
2119
2060
2120
/**
2061
2121
* Creates a [Float64List] with the same length as the [elements] list
2062
2122
* and copies over the elements.
2123
+ *
2124
+ * The list is backed by a [ByteBuffer] containing precisely
2125
+ * `elements.length` times 8 bytes.
2063
2126
*/
2064
2127
external factory Float64List .fromList (List <double > elements);
2065
2128
@@ -2176,12 +2239,18 @@ abstract class Float32x4List implements List<Float32x4>, TypedData {
2176
2239
/**
2177
2240
* Creates a [Float32x4List] of the specified length (in elements),
2178
2241
* all of whose elements are initially zero.
2242
+ *
2243
+ * The list is backed by a [ByteBuffer] containing precisely
2244
+ * [length] times 16 bytes.
2179
2245
*/
2180
2246
external factory Float32x4List (int length);
2181
2247
2182
2248
/**
2183
2249
* Creates a [Float32x4List] with the same length as the [elements] list
2184
2250
* and copies over the elements.
2251
+ *
2252
+ * The list is backed by a [ByteBuffer] containing precisely
2253
+ * `elements.length` times 16 bytes.
2185
2254
*/
2186
2255
external factory Float32x4List .fromList (List <Float32x4 > elements);
2187
2256
@@ -2306,12 +2375,18 @@ abstract class Int32x4List implements List<Int32x4>, TypedData {
2306
2375
/**
2307
2376
* Creates a [Int32x4List] of the specified length (in elements),
2308
2377
* all of whose elements are initially zero.
2378
+ *
2379
+ * The list is backed by a [ByteBuffer] containing precisely
2380
+ * [length] times 16 bytes.
2309
2381
*/
2310
2382
external factory Int32x4List (int length);
2311
2383
2312
2384
/**
2313
2385
* Creates a [Int32x4List] with the same length as the [elements] list
2314
2386
* and copies over the elements.
2387
+ *
2388
+ * The list is backed by a [ByteBuffer] containing precisely
2389
+ * `elements.length` times 16 bytes.
2315
2390
*/
2316
2391
external factory Int32x4List .fromList (List <Int32x4 > elements);
2317
2392
@@ -2436,12 +2511,18 @@ abstract class Float64x2List implements List<Float64x2>, TypedData {
2436
2511
/**
2437
2512
* Creates a [Float64x2List] of the specified length (in elements),
2438
2513
* all of whose elements have all lanes set to zero.
2514
+ *
2515
+ * The list is backed by a [ByteBuffer] containing precisely
2516
+ * [length] times 16 bytes.
2439
2517
*/
2440
2518
external factory Float64x2List (int length);
2441
2519
2442
2520
/**
2443
2521
* Creates a [Float64x2List] with the same length as the [elements] list
2444
2522
* and copies over the elements.
2523
+ *
2524
+ * The list is backed by a [ByteBuffer] containing precisely
2525
+ * `elements.length` times 16 bytes.
2445
2526
*/
2446
2527
external factory Float64x2List .fromList (List <Float64x2 > elements);
2447
2528
0 commit comments