parseBytes<T> static method
T
parseBytes<
T>({ - required Object? value,
- required String name,
})
Implementation
static T parseBytes<T>({required Object? value, required String name}) {
if (<int>[] is! T) {
throw const TronPluginException("Invalid type casting for bytes parser.");
}
if (value == null && null is T) return null as T;
if (value == null) {
throw TronPluginException("Missing parameter: $name.");
}
if (value is String) {
return StringUtils.toBytes(value) as T;
}
throw TronPluginException("Invalid value for parameter: $name.");
}