How to allow parameters on different lines in Dart?

Issue

When i set lineLength to 200, which I would like to keep to not be limited, dart formatter is changing this:

throw RequestException(
  message: responseData['message'],
  statusCode: responseData['status'],
  response: responseData['response']
);

to this:

throw RequestException(message: responseData['message'], statusCode: responseData['status'], response: responseData['response']);

How can I allow parameters on different lines? More generally, how can I force it to keep my multi-lines for any kind of statement?

Solution

try ending it with a ,

Like this:

throw RequestException(
  message: responseData['message'],
  statusCode: responseData['status'],
  response: responseData['response'],  // <- here
);

Answered By – pedro pimont

Answer Checked By – Terry (FlutterFixes Volunteer)

Leave a Reply

Your email address will not be published.