to_string_pretty 1.0.2 copy "to_string_pretty: ^1.0.2" to clipboard
to_string_pretty: ^1.0.2 copied to clipboard

outdated

Prints an object pretty.

toStringPretty #

Prints an object pretty.

Installing #

dependencies:
  to_string_pretty:
import 'package:to_string_pretty/to_string_pretty.dart';

Usage #

  • Basic

    var data = ['google', 'apple', 'thanks'];
    print(toStringPretty(data));
    
    // stdout
    [
        google,
        apple,
        thanks,
    ],
    
  • toString()

    Code

    class ChatMessage {
      // member variables, methods...
        
      @override
      String toString() => toStringPretty(this, {
        'body': message
        'sentBy': sentBy,
        'sentAt': sentAt,
        'group': group,
      });
    }
      
    print(ChatMessage());
    
    // stdout
    ChatMessage {
        body: Thanks,
        sentBy: ChatUser {
            email: hello@example.com,
            name: Liam,
        },
        sentAt: ChatDateTime {
            datetime: 2021-02-21 19:07:00.000,
        },
        group: Flutter Community,
    },
    

Feature requests and Bug reports #

here