leb128 1.1.0 copy "leb128: ^1.1.0" to clipboard
leb128: ^1.1.0 copied to clipboard

A Dart package that can read and write numbers in the LEB128, short for Little Endian Base 128, format.

example/lib/main.dart

import 'dart:typed_data';
import 'package:logger/logger.dart';
import 'package:leb128/leb128.dart';

void main() {
  int input = -9019283812387;
  Logger logger = Logger();

  // Encode the negative number shown above
  Uint8List output = Leb128.encodeSigned(input);

  // Print the individual bytes of the encoded
  // number in hex
  for (int i = 0; i < output.length; i++) {
    logger.i(output[i].toRadixString(16));
  }

  // Decode the LEB128 number into an ordinary integer and
  // print it
  logger.i(Leb128.decodeSigned(output));

  // Quickly decode a varuint7
  logger.i(Leb128.decodeVaruint7(0x08).toRadixString(16));
}
2
likes
130
pub points
47%
popularity

Publisher

unverified uploader

A Dart package that can read and write numbers in the LEB128, short for Little Endian Base 128, format.

Repository (GitHub)
View/report issues

Documentation

API reference

License

Apache-2.0 (LICENSE)

Dependencies

flutter

More

Packages that depend on leb128