Skip to content
pubscout

base_x

2.0.1, released 3 years ago by an unverified publisher

Fast base encoding and decoding of any given alphabet using bitcoin style leading zero compression.

WASM-ready
$ flutter pub add base_x
Source repository

What it does

Provides a BaseXCodec class to encode byte data and decode strings using custom or standard variable-length alphabets. It is a direct derivation of the base58 implementation from bitcoin/bitcoin, generalized for variable lengths.

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

Use it when

  • You need custom base encoding or decoding like Base58 for cryptocurrencies
  • You need to encode and decode data using non-standard variable-length alphabets

Skip it when

  • You require RFC3548 compliant standard base16, base32, or base64 encoding
  • You are looking for UI widgets or state management

Strengths

  • Fast implementation of base encoding and decoding
  • Supports custom alphabets of any length
  • Supports null safety

Weaknesses

  • Not RFC3548 compliant for standard bases like base16, base32, or base64
  • Limited documentation outside of the basic README examples

Setup

Kind
Pure Dart
Effort
Low
Code generation
No
Direct dependencies
0

No native setup required.

import 'package:base_x/base_x.dart';

var base58 = BaseXCodec('123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz');
var hash = Uint8List.fromList([14, 251, 24, 220, 202, 235, 97, 232, 85, 229, 109, 188, 53, 146, 43, 36, 246, 238, 110, 55, 202, 163, 160, 123, 169, 35]);

print(base58.encode(hash));
print(base58.decode('TcASfmyoFiNobNaCHeiPMkWgGmovoxk1sqk'));

Alternatives

Packages that do the same job and could replace base_x.

  • cbor

    A Dart library for RFC8949‑compliant CBOR encoding and decoding.

  • pem

    PEM encoding and decoding of textual keys and certificates following RFC 7468.

  • qs_dart

    A query string encoding and decoding library for Dart ported from JavaScript's qs.

  • fast_base58

    Fast Base58 encoding and decoding library supporting Bitcoin and Flickr alphabets.

Works with

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