to_string_pretty 1.1.0
to_string_pretty: ^1.1.0 copied to clipboard
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()
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, },