Created
November 4, 2025 14:01
-
-
Save rena2019/ca29ed511cacca57e61b40c341456196 to your computer and use it in GitHub Desktop.
flutter bytes buffer / byte data
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ///flutter bytes buffer / byte data | |
| import 'dart:typed_data'; | |
| void main() { | |
| final bytes = Uint8List.fromList([0,0,1,0]); | |
| final bd = ByteData.sublistView(bytes, 0, 4); | |
| print(bd.getInt32(0));//256 | |
| bd.setInt32(0, 65536); | |
| print(bd.getInt32(0));//65536 | |
| print(bytes);//[0, 1, 0, 0] | |
| bd.setInt8(0, 123); | |
| print(bytes);//[123, 1, 0, 0] | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment