get<T> method
T
get<T>()
Implementation
T get<T>() {
if (value is T) return value;
if (value is List<int> && _isTypeString<T>()) {
return StringUtils.decode(value) as T;
}
if (value is int) {
if (BigInt.zero is T) {
return BigInt.from(value) as T;
} else if (false is T) {
if (value != 0 && value != 1) {
throw TronPluginException("Invalid boolean value.",
details: {"value": value});
}
return (value == 1 ? true : false) as T;
}
} else if (value is BigInt && 0 is T) {
return (value as BigInt).toInt() as T;
}
throw TronPluginException("Invalid type.",
details: {"type": "$T", "Excepted": value.runtimeType.toString()});
}