Skip to content

Latest commit

 

History

32 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 

Repository files navigation

to-string

Generate toString() for classes

Usage

@toString
class MyClass {
  @override
  String toString() => _$toString();

  final a = 0;
  final b = 0;
}
// MyClass {a: 0, b:0}

Ignoring a field:

@toString
class MyClass {
  @override
  String toString() => _$toString();

  final a = 0;
  @ignore
  final b = 0;
}
// MyClass {a: 0}

Formatting a field:

@toString
class MyClass {
  @override
  String toString() => _$toString();

  final a = 0;
  @Format(r"${$?.toStringAsFixed(1)}")
  final double b = 1.234;
}
// MyClass {a: 0, b:1.2}

For more details, checkout the example dir.

About

Generate toString() for classes. Mirror of https://gitlab.com/nkming2/dart-to-string

Topics

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages