valueToInline static method

String valueToInline(
  1. Object? value, {
  2. int maxLength = 56,
})

Implementation

static String valueToInline(Object? value, {int maxLength = 56}) {
  final safeLength = maxLength < 4 ? 4 : maxLength;
  String encoded;
  try {
    encoded = const JsonEncoder().convert(value);
  } catch (_) {
    encoded = value.toString();
  }
  if (encoded.length <= safeLength) return encoded;
  return '${encoded.substring(0, safeLength - 3)}...';
}