Improve documentation of integers endianness.
Added to the documentation that integers should be of the same endianness of the host.
- I have lost 2 hours to discover that `asUint32List` requires the same endianness of `Endian.host`.
Closes https://github.com/dart-lang/sdk/pull/47980
https://github.com/dart-lang/sdk/pull/47980
GitOrigin-RevId: 1a1728602735434efd3e505d76e4f45b8161ea14
Change-Id: Id8a1fd8c5c4dced141881a1ce64577fdcbb8b62e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/225080
Reviewed-by: Lasse Nielsen <lrn@google.com>
Commit-Queue: Lasse Nielsen <lrn@google.com>
diff --git a/sdk/lib/typed_data/typed_data.dart b/sdk/lib/typed_data/typed_data.dart
index 5d07d41..2a67153 100644
--- a/sdk/lib/typed_data/typed_data.dart
+++ b/sdk/lib/typed_data/typed_data.dart
@@ -82,7 +82,8 @@
/// and vice versa.
///
/// The viewed region start at [offsetInBytes], which must be 16-bit aligned,
- /// and contains [length] 16-bit integers.
+ /// and contains [length] 16-bit integers with
+ /// the same endianness as the host ([Endian.host]).
/// If [length] is omitted, the range extends as far towards the end of
/// the buffer as possible -
/// if [lengthInBytes] is not even, the last byte can't be part of the view.
@@ -103,7 +104,8 @@
/// and vice versa.
///
/// The viewed region start at [offsetInBytes], which must be 16-bit aligned,
- /// and contains [length] 16-bit integers.
+ /// and contains [length] 16-bit integers with
+ /// the same endianness as the host ([Endian.host]).
/// If [length] is omitted, the range extends as far towards the end of
/// the buffer as possible -
/// if [lengthInBytes] is not even, the last byte can't be part of the view.
@@ -124,7 +126,8 @@
/// and vice versa.
///
/// The viewed region start at [offsetInBytes], which must be 32-bit aligned,
- /// and contains [length] 32-bit integers.
+ /// and contains [length] 32-bit integers with
+ /// the same endianness as the host ([Endian.host]).
/// If [length] is omitted, the range extends as far towards the end of
/// the buffer as possible -
/// if [lengthInBytes] is not divisible by four, the last bytes can't be part
@@ -146,7 +149,8 @@
/// and vice versa.
///
/// The viewed region start at [offsetInBytes], which must be 32-bit aligned,
- /// and contains [length] 32-bit integers.
+ /// and contains [length] 32-bit integers with
+ /// the same endianness as the host ([Endian.host]).
/// If [length] is omitted, the range extends as far towards the end of
/// the buffer as possible -
/// if [lengthInBytes] is not divisible by four, the last bytes can't be part
@@ -168,7 +172,8 @@
/// and vice versa.
///
/// The viewed region start at [offsetInBytes], which must be 64-bit aligned,
- /// and contains [length] 64-bit integers.
+ /// and contains [length] 64-bit integers with
+ /// the same endianness as the host ([Endian.host]).
/// If [length] is omitted, the range extends as far towards the end of
/// the buffer as possible -
/// if [lengthInBytes] is not divisible by eight, the last bytes can't be part
@@ -190,7 +195,8 @@
/// and vice versa.
///
/// The viewed region start at [offsetInBytes], which must be 64-bit aligned,
- /// and contains [length] 64-bit integers.
+ /// and contains [length] 64-bit integers with
+ /// the same endianness as the host ([Endian.host]).
/// If [length] is omitted, the range extends as far towards the end of
/// the buffer as possible -
/// if [lengthInBytes] is not divisible by eight, the last bytes can't be part