Documentation of Uint8List.operator + is incorrect. It returns a List<int>. #51034
Labels
area-core-library
SDK core library issues (core, async, ...); use area-vm or area-web for platform specific libraries.
library-typed-data
type-documentation
A request to add or improve documentation
The documentation of Uint8List.operator + says that if both operands are Uint8List, it returns a Uint8List.
This is incorrect, it always returns a List.
The documentation says:
That this means it can return a Uint8List is made clear by the note in the documentation of List.operator +, that says:
From the beginning, when this method was added to Uint8List in https://dart-review.googlesource.com/c/sdk/+/39140
, the method did not return a Uint8List, but inherited its implementation through _TypedIntList, https://dart-review.googlesource.com/c/sdk/+/39140/4/sdk/lib/typed_data/typed_data.dart#386 , which has since been replaced by a mixin.
I think the implementation of these classes should be changed so that this documentation is true, but until then, the
documentation should be correct.
This override of Uint8List.operator + is also not present on Int8List or other similar classes. Only Uint8 has it.
The text was updated successfully, but these errors were encountered: