json static method

void json(
  1. dynamic jsonObject, {
  2. String? tag,
})

打印 JSON 格式化输出

Implementation

static void json(dynamic jsonObject, {String? tag}) {
  if (!_enabled) return;
  try {
    final encoder = const JsonEncoder.withIndent('  ');
    final prettyJson = encoder.convert(jsonObject);
    d('JSON Output:\n$prettyJson', tag: tag);
  } catch (error) {
    e('Failed to format JSON: $error', tag: tag);
  }
}