Skip to content
pubscout

byte_extensions

0.0.4, released 9 months ago by flutter.institute

Extensions to convert int, double, BigInt and strings to/from byte arrays with endianness control

WASM-ready
$ flutter pub add byte_extensions
Source repository

What it does

Provides helper methods for converting common numeric types and strings to byte representations and back. Supports signed/unsigned integers of various bit widths, IEEE‑754 doubles, and fast string encoding.

AI-written summary of version 0.0.4, based on the package's README and metadata. Report an inaccuracy

Use it when

  • You need to serialize numeric data to bytes for networking or file I/O
  • You want to convert strings to bytes efficiently for binary protocols
  • You need endianness control for cross‑platform compatibility

Skip it when

  • You require high‑performance binary serialization beyond simple conversions
  • You need advanced encoding like Base64 or custom binary formats
  • You are building a full serialization framework

Strengths

  • Simple API, no dependencies
  • Supports multiple bit widths and endianness
  • Fast string byte encoding helpers

Weaknesses

  • Limited to basic types, no complex object serialization
  • No support for custom encoders or compression
  • No documentation on performance benchmarks

Setup

Kind
Pure Dart
Effort
Low
Code generation
No
Direct dependencies
0
import 'package:byte_extensions/byte_extensions.dart';

final bytes = 12345.toBytes(endian: Endian.big, signed: true, bits: 32);
final value = bytes.toInt(endian: Endian.big, signed: true, bits: 32);

Alternatives

Packages that do the same job and could replace byte_extensions.

  • mime

    Utilities to resolve MIME types from file names, magic bytes, and to parse multipart streams.

  • dart_either

    Either monad for Dart and Flutter supporting type-safe error handling and railway-oriented programming.

  • mime2extension

    Convert between MIME types and file extensions and detect file types from base64 data.

  • result_type

    A Result type representing success or failure in Dart

Works with

Packages commonly used together with byte_extensions: ones it builds on, ones built on it, and its own family.