@@ -9,18 +9,12 @@ abstract class TypedDataBuffer<E> extends ListBase<E> {
99 static const int _initialLength = 8 ;
1010
1111 /// The underlying data buffer.
12- ///
13- /// This is always both a List<E> and a TypedData, which we don't have a type
14- /// for here. For example, for a `Uint8Buffer` , this is a `Uint8List` .
15- List <E > _buffer;
16-
17- /// Returns a view of [_buffer] as a [TypedData] .
18- TypedData get _typedBuffer => _buffer as TypedData ;
12+ TypedDataList <E > _buffer;
1913
2014 /// The length of the list being built.
2115 int _length;
2216
23- TypedDataBuffer (List <E > buffer)
17+ TypedDataBuffer (TypedDataList <E > buffer)
2418 : _buffer = buffer,
2519 _length = buffer.length;
2620
@@ -47,7 +41,7 @@ abstract class TypedDataBuffer<E> extends ListBase<E> {
4741 _buffer[i] = defaultValue;
4842 }
4943 } else if (newLength > _buffer.length) {
50- List <E > newBuffer;
44+ TypedDataList <E > newBuffer;
5145 if (_buffer.isEmpty) {
5246 newBuffer = _createBuffer (newLength);
5347 } else {
@@ -249,7 +243,7 @@ abstract class TypedDataBuffer<E> extends ListBase<E> {
249243 /// be. If [requiredCapacity] is not null, it will be at least that
250244 /// size. It will always have at least have double the capacity of
251245 /// the current buffer.
252- List <E > _createBiggerBuffer (int ? requiredCapacity) {
246+ TypedDataList <E > _createBiggerBuffer (int ? requiredCapacity) {
253247 var newLength = _buffer.length * 2 ;
254248 if (requiredCapacity != null && newLength < requiredCapacity) {
255249 newLength = requiredCapacity;
@@ -283,19 +277,19 @@ abstract class TypedDataBuffer<E> extends ListBase<E> {
283277
284278 // TypedData.
285279
286- int get elementSizeInBytes => _typedBuffer .elementSizeInBytes;
280+ int get elementSizeInBytes => _buffer .elementSizeInBytes;
287281
288- int get lengthInBytes => _length * _typedBuffer .elementSizeInBytes;
282+ int get lengthInBytes => _length * _buffer .elementSizeInBytes;
289283
290- int get offsetInBytes => _typedBuffer .offsetInBytes;
284+ int get offsetInBytes => _buffer .offsetInBytes;
291285
292286 /// Returns the underlying [ByteBuffer] .
293287 ///
294288 /// The returned buffer may be replaced by operations that change the [length]
295289 /// of this list.
296290 ///
297291 /// The buffer may be larger than [lengthInBytes] bytes, but never smaller.
298- ByteBuffer get buffer => _typedBuffer .buffer;
292+ ByteBuffer get buffer => _buffer .buffer;
299293
300294 // Specialization for the specific type.
301295
@@ -304,7 +298,7 @@ abstract class TypedDataBuffer<E> extends ListBase<E> {
304298 E get _defaultValue;
305299
306300 // Create a new typed list to use as buffer.
307- List <E > _createBuffer (int size);
301+ TypedDataList <E > _createBuffer (int size);
308302}
309303
310304abstract class _IntBuffer extends TypedDataBuffer <int > {
0 commit comments