pretty_print 2.1.0 copy "pretty_print: ^2.1.0" to clipboard
pretty_print: ^2.1.0 copied to clipboard

A powerful Dart library for terminal text styling with ANSI escape codes. Features 75+ extension methods and logging utilities.

example/example.dart

import 'package:pretty_print/pretty_print.dart';

void main() {
  // Welcome header
  "🎨 Pretty Print v2.0+ - Grouped Extensions Demo".formatting.header();

  // Logging examples
  "\nπŸ“ Logging Methods".styling.bold(PrintColor.yellow);
  "Operation completed successfully!".logging.successLog();
  "Application started".logging.infoLog();
  "This feature is deprecated".logging.warningLog();
  "Failed to connect to database".logging.errorLog();
  "Debugging user authentication".logging.debugLog();
  "Critical system failure".logging.criticalLog();
  "Entering function".logging.traceLog();
  "Database query took 150ms".logging.performanceLog();

  "".formatting.separator();

  // Styling examples
  "\n🎭 Text Styling Methods".styling.bold(PrintColor.yellow);
  "Bold text".styling.bold();
  "Italic text".styling.italic();
  "Underlined text".styling.underline();
  "Strikethrough text".styling.lineThrough();
  "Blinking text".styling.blink();
  "Bold + Underlined".styling.boldUnderline();
  "All effects combined".styling.allEffects();

  "".formatting.separator();

  // Color examples
  "\n🌈 Color Methods".styling.bold(PrintColor.yellow);
  "Red text".colors.red();
  "Green text".colors.green();
  "Blue text".colors.blue();
  "Yellow text".colors.yellow();
  "Text on red background".colors.onRed();
  "Text on green background".colors.onGreen();
  "Bold red".colors.boldRed();
  "Bold green".colors.boldGreen();

  "".formatting.separator();

  // Formatting examples
  "\nπŸ“‹ Formatting Methods".styling.bold(PrintColor.yellow);

  "Boxed Content".formatting.box();

  "Double Box Content".formatting.doubleBox();

  "".formatting.separator();
  "Bullet item 1".formatting.bullet();
  "Bullet item 2".formatting.bullet();
  "Numbered item".formatting.numbered(1);
  "Numbered item".formatting.numbered(2);
  "    Indented text".formatting.indent(2);
  "Famous quote here".formatting.quote();
  "console.log('Hello')".formatting.code();

  "".formatting.separator();

  // Debug examples
  "\nπŸ› Debug Methods".styling.bold(PrintColor.yellow);

  "Variable inspection".debug.debugPrint();
  "Fix this later".debug.todo();
  "This needs attention".debug.fixme();
  "Important note".debug.note();
  "Response data".debug.inspect();
  "Performance check".debug.benchmark();
  "Memory usage".debug.memory();
  "API call status".debug.network();
  "userName".debug.variable("john_doe");
  "User is authenticated".debug.assertion();
  "Old method usage".debug.deprecated();
  "New feature test".debug.experimental();

  "".formatting.separator();

  // Advanced examples
  "\n✨ Advanced Formatting".styling.bold(PrintColor.yellow);

  "Rainbow text!".colors.rainbow();

  "\nπŸ“Š Layout Examples".styling.bold(PrintColor.yellow);

  "Left aligned".formatting.leftAlign(30);
  "Right aligned".formatting.rightAlign(30);
  "Centered".formatting.center(30);

  "\nπŸ”§ Utility Methods".styling.bold(PrintColor.yellow);

  "Hello".formatting.withPrefix(">>> ");
  "World".formatting.withSuffix(" <<<");
  "Prefixed".formatting.withPrefix("🎯 ");

  "\nπŸ“ List Formatting".styling.bold(PrintColor.yellow);

  "First item".formatting.bullet();
  "Second item".formatting.bullet();
  "Third item".formatting.bullet();

  "\nπŸ”’ Numbered Lists".styling.bold(PrintColor.white);
  "Setup environment".formatting.numbered(1);
  "Install dependencies".formatting.numbered(2);
  "Run tests".formatting.numbered(3);

  "\nπŸ’¬ Text Formatting".styling.bold(PrintColor.yellow);

  "This is a famous quote from someone".formatting.quote();
  "function helloWorld() { return 'Hello!'; }".formatting.code();
  "Normal text".formatting.indent(0);
  "    Indented once".formatting.indent(1);

  "".formatting.separator();

  // Comprehensive demo
  "\n🎯 Comprehensive Demo".formatting.header();

  "This demo showcases the new grouped extension API!".styling.bold(
    PrintColor.green,
  );

  "\nβœ… Benefits:".styling.bold(PrintColor.white);
  "Organized methods by category".formatting.bullet();
  "Cleaner IDE autocomplete".formatting.bullet();
  "Better discoverability of features".formatting.bullet();

  "\n🎨 Usage Pattern:".styling.bold(PrintColor.white);
  'string.logging.successLog()    // For logging'.colors.cyan();
  'string.styling.bold()          // For text styling'.colors.cyan();
  'string.colors.red()            // For colors'.colors.cyan();
  'string.formatting.box()        // For layout'.colors.cyan();
  'string.debug.debugPrint()      // For debugging'.colors.cyan();

  "\nπŸš€ Try the new API!".styling.bold(PrintColor.magenta);
  "Visit pub.flutter-io.cn/packages/pretty_print for more info".colors.rainbow();
}
1
likes
160
points
233
downloads
screenshot

Publisher

verified publishermomaher.dev

Weekly Downloads

A powerful Dart library for terminal text styling with ANSI escape codes. Features 75+ extension methods and logging utilities.

Repository (GitHub)
View/report issues

Topics

#terminal #console #logging #ansi #print

Documentation

API reference

License

MIT (license)

More

Packages that depend on pretty_print