class_to_string 1.0.0 copy "class_to_string: ^1.0.0" to clipboard
class_to_string: ^1.0.0 copied to clipboard

It allows to get beautiful class to string.

It allows to get beautiful class to string. Generally used in code generators for example in mek_data_class

Features #

  • Supported nested classes
  • Generate a single-line string from a class
  • Generate a multi-line string from a class
  • Generate a json string from a class
  • Generate a yaml string from a class

Usage #

Follow the example and remember that null values will not be included

class Product {
  final String name;
  final double? price;

  const Product({required this.name, this.price});
  
  String toString() =>
      (ClassToString('Product')
        ..add('name', name)..add('price', price)).toString();
} 

Additional information #

If you can add support for json and yaml! If you can improve the readability by differentiating a string from a number! For example "12" and 12

2
likes
110
pub points
52%
popularity

Publisher

unverified uploader

It allows to get beautiful class to string.

Homepage
Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (LICENSE)

More

Packages that depend on class_to_string