encode_endian 1.0.0 encode_endian: ^1.0.0 copied to clipboard
A library can convert integer to big endian or little endian.
A library can convert integer to big endian or little endian.
A Dart version of endian-code
Usage #
A simple usage example:
import 'package:encode_endian/encode_endian.dart';
import 'package:encode_endian/base.dart';
main() {
// default convert to big endian
// [0x01, 0x02]
encodeEndian(0x0102, 2);
// [255, 221]
encodeEndian(-35, 2);
// [0x00, 0x00, 0x12, 0x34]
encodeEndian(0x1234, 4);
// convert to little endian
// [0x34, 0x12]
encodeEndian(0x1234, 2, endianType: EndianType.littleEndian);
}
Features and bugs #
Please file feature requests and bugs at the issue tracker.