encode method

  1. @override
Uint8List encode(
  1. Object value
)
override

Implementation

@override
Uint8List encode(Object value) {
  final exception = Exception(
      'Invalid value for type "$this": $value (${value.runtimeType})');
  if (value is! String) throw exception;

  var s = value.toLowerCase().trim();
  if (s.length != 20) throw exception;

  return IntType.encodeFromBigInt(BigInt.parse(s, radix: 16));
}