formatTextAllocatedWith method

String formatTextAllocatedWith(
  1. VtAllocator allocator, {
  2. Encoding encoding = utf8,
})

Formats via formatBytesAllocatedWith and decodes the result.

Implementation

String formatTextAllocatedWith(
  VtAllocator allocator, {
  Encoding encoding = utf8,
}) {
  final bytes = formatBytesAllocatedWith(allocator);
  if (encoding == utf8) {
    return utf8.decode(bytes, allowMalformed: true);
  }
  return encoding.decode(bytes);
}