Base64Plugin class

Base64 Plugin - Automatic encoding/decoding of payload values.

Bundles Base64 encode and decode hooks for easy installation.

Features

  • Encode hook: Converts payload value to Base64 on writes
  • Decode hook: Converts Base64 string back to original on reads
  • URL-safe option: Use URL-safe Base64 encoding

Example

final engine = HiEngine();
Base64Plugin().install(engine);

// With URL-safe encoding
Base64Plugin(urlSafe: true).install(engine);

// Decode to bytes instead of string
Base64Plugin(decodeAsString: false).install(engine);

Constructors

Base64Plugin({List<String> writeEvents = const ['write', 'put'], List<String> readEvents = const ['read', 'get'], bool urlSafe = false, bool decodeAsString = true, bool enableEncode = true, bool enableDecode = true})
Creates a Base64 plugin with configurable options.

Properties

decodeAsString bool
Whether to decode as String (true) or Uint8List (false).
final
enableDecode bool
Whether to register decode hook.
final
enableEncode bool
Whether to register encode hook.
final
hashCode int
The hash code for this object.
no setterinherited
readEvents List<String>
Events that trigger decoding.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
urlSafe bool
Use URL-safe Base64 encoding.
final
writeEvents List<String>
Events that trigger encoding.
final

Methods

build() → HiPlugin
Builds the HiPlugin for installation.
install(HiEngine engine) → void
Convenience method to build and install in one step.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited