web3ErrorFormat static method

String web3ErrorFormat(
  1. String input
)

链上错误消息格式化

Implementation

static String web3ErrorFormat(String input) {
  String res = '';
  try {
    RegExp regex = RegExp(r'"([^"]*)"');
    final match = regex.firstMatch(input);
    if (match != null) {
      res = match.group(1)!;
    } else {
      res = input;
    }
  } catch (e) {
    res = input;
  }
  return res;
}