Hey folks,
The dart formatter is awesome and I also see the clear advantages that dart code is formatted the same for all developers. But there is always one thing that my eyes can’t get used to and in my opinion dart doesn’t have a reasonable default here.
Chain a series of functions and assign the result to a variable. If the line length is exceeded, the assignment is wrapped, instead of splitting the chain into individual lines.
final someIndexedData = <String, ({String jobId})>{};
// The ugly Default:
final job1 =
someIndexedData.values.where((job) => job.jobId == '3').firstOrNull;
// Tweak with tailing comma, but still ugly
final job2 = someIndexedData.values
.where(
(job) => job.jobId == '3',
)
.firstOrNull;
// The desired formatting can only be achieved if the second line
// also exceeds the line limit.
final job3 = someIndexedData.values
.where((currentJob) => currentJob.jobId == '3')
.firstOrNull;
I know formatting is hard, but is there a reason for that, I don’t see? Am I the only one or is there a silent majority who also dislike it? Is Bob around ?