binarize 1.0.0+1
binarize: ^1.0.0+1 copied to clipboard

Binarize allows for a more streamlined and extendable binary creation experience.

example/main.dart

import 'package:binarize/binarize.dart';

void main() {
  // Writing bytes.
  final writer = Payload.write();
  writer.set(boolean, true);
  writer.set(flags, [true, false, true]);
  writer.set(float32, 1.5);
  writer.set(float64, 3.5);
  writer.set(int8, 5);
  writer.set(int16, -15);
  writer.set(int32, 38);
  writer.set(int64, -2050);
  writer.set(string, 'Hello world');
  writer.set(uint8, 5);
  writer.set(uint16, 15);
  writer.set(uint32, 30);
  writer.set(uint64, 60);

  // Converting to bytes.
  final byteList = binarize(writer);

  // Reading bytes.
  final reader = Payload.read(byteList);
  print(reader.get(boolean));
  print(reader.get(flags));
  print(reader.get(float32));
  print(reader.get(float64));
  print(reader.get(int8));
  print(reader.get(int16));
  print(reader.get(int32));
  print(reader.get(int64));
  print(reader.get(string));
  print(reader.get(uint8));
  print(reader.get(uint16));
  print(reader.get(uint32));
  print(reader.get(uint64));
}
7
likes
130
pub points
25%
popularity

Publisher

wolfenra.in

Binarize allows for a more streamlined and extendable binary creation experience.

Repository (GitLab)
View/report issues

Documentation

API reference

License

MIT (LICENSE)

More

Packages that depend on binarize