티스토리 뷰
The Dart int type is a 64-bit two's complement number—except when compiled for the web, there it's a 64-bit floating point number with no fractional part (a JavaScript number which has an integer value).
How those values are represented internally depends on optimizations, they can be represented as something smaller if the runtime system knows for sure that the value will fit. That's an optimization, you won't be able to tell the difference.
A "byte" value is an integer in the range 0..255. You can obviously store a byte value in an int.
The most efficient way to store multiple bytes is a Uint8List, which implements List<int>. It stores each element as a single octet. When you read a value out of a Unit8List, its byte value is represented by an int. When you store an int in the Uint8List, only the low 8 bites are stored. So it does expanding reads and truncating writes to move values between an octet and a 64-bit value.
How does an "int" represent a byte (8 bits) when an int is normally 32 or 64 bits?
I'm curious how in the Dart programming language a byte is represented by the int type. I am is confusing because in Java, which Dart closely resembles, an int is 32 bits. I ask because the leading
stackoverflow.com
'Dart & Flutter > 궁금했던 것, 몰랐던 것' 카테고리의 다른 글
iOS 14 이상에서는 개발과정에서 설치한 앱 실행 안됨 (0) | 2023.02.08 |
---|---|
syncfusion chart 로딩이 오래 걸린다. (0) | 2023.01.19 |
audioplayers (0) | 2022.07.25 |
앱에서 생성한 파일 저장하기 (2) | 2022.07.15 |
Text 위젯의 fontSize 에 적당한 Container 위젯의 Height (0) | 2022.07.06 |
- Total
- Today
- Yesterday
- Chrome
- 앱
- 에러
- addPostFrameCallback
- 한빛미디어
- UX
- 문제 해결
- 플러터
- BLE
- IOS
- 인사이트
- Syncfusion
- 크롬
- 다트
- hide
- DART
- TextFormField
- Flutter
- plugin
- 디자인
- Bluetooth
- UI
- TextField
- SizedBox
- firebase
- 앱 프로그래밍
- position
- 이미지
- error
- 앱개발
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | ||
6 | 7 | 8 | 9 | 10 | 11 | 12 |
13 | 14 | 15 | 16 | 17 | 18 | 19 |
20 | 21 | 22 | 23 | 24 | 25 | 26 |
27 | 28 | 29 | 30 |