ToString class
Allows you get rid of boring toString overriding, Ides does the same, but with this annotation hide the so long string to make your class more cleaner and if you change the class property you have no worries.
To do so, annotate your class with ToString and override toString method to make it point to the generated one as below.
@ToString()
class User {
User(
this.firstName,
this.lastName,
this.email,
this.phone,
this.dateOfBirth,
this.country,
this.city,
this.postalCode,
);
final String firstName;
final String lastName;
final String email;
final String phone;
final DateTime dateOfBirth;
final String country;
final String city;
final String postalCode;
@override
String toString() => $toString();
}
Constructors
-
ToString.new({bool includePrivets = true, List<
String> ? exclude}) -
Allows you get rid of boring toString overriding, Ides does the same,
but with this annotation hide the so long string to make your class
more cleaner and if you change the class property you have no worries.
const
Properties
-
exclude
→ List<
String> ? -
Exclude specific fields by passing there name.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- includePrivets → bool
-
Allows privet fields to be part of toString result.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited