fromValue static method
Implementation
static RLPItem<dynamic> fromValue(dynamic value) {
if (value is int) {
return RLPInt(value);
} else if (value is String) {
if (value.startsWith("#")) {
return RLPBigInt(BigInt.parse(value.substring(1)));
}
return RLPString(value);
} else if (value is BigInt) {
return RLPBigInt(value);
} else if (value is Uint8List) {
return RLPBytes(value);
} else if (value is List) {
final items = value.map((item) => RLPItem.fromValue(item)).toList();
return RLPList(items);
}
throw ArgumentError("Unsupported type: ${value.runtimeType}");
}