Target Platform: All
Target OS version/browser: All
Devices: Chrome
WriteBuffer
aligment
import 'dart:typed_data'; | |
import 'package:flutter/foundation.dart'; | |
void main() { | |
final buffer1 = WriteBuffer() | |
..putUint16(0, endian: Endian.little); | |
var b1 = buffer1.done().buffer.asUint8List(); | |
print('${b1.length} $b1'); | |
final byteData1 = ByteData(2) | |
..setUint16(0, 0, Endian.little); | |
var b2 = byteData1.buffer.asUint8List(); | |
print('${b2.length} $b2'); | |
final buffer2 = WriteBuffer() | |
..putUint8(0) | |
..putUint16(0, endian: Endian.little); | |
var b3 = buffer2.done().buffer.asUint8List(); | |
print('${b3.length} $b3'); | |
final byteData2 = ByteData(3) | |
..setUint8(0, 0) | |
..setUint16(1, 0, Endian.little); | |
var b4 = byteData2.buffer.asUint8List(); | |
print('${b4.length} $b4'); | |
} |