I think dart formatter is not working right. As an example:
controller2.animateToPage(frameworksPage, duration: const Duration(milliseconds: 480), curve: Curves.fastOutSlowIn);
formats as:
controller2.animateToPage(
frameworksPage,
duration: const Duration(
milliseconds: 480),
curve: Curves.fastOutSlowIn);
and it gets even worse when it gets to if statements. Is there a solution for this bs?
CodePudding user response:
Add a ,
behind Curves.fastOutSlowIn
and it should look a little better. Also maybe you have the maximum line length set very low so it might wrap to the next line a little to early
CodePudding user response:
Make sure there are no syntax errors somewhere in the same file. The formatter sometimes stops working if there are syntax errors.
I tried to reproduce the problem, but the formatter worked just fine:
final PageController controller2 = PageController(initialPage: 0);
final frameworksPage = 1;
controller2.animateToPage(frameworksPage,
duration: const Duration(milliseconds: 480),
curve: Curves.fastOutSlowIn);
However, I suggest adding a trailing comma behind the curve
parameter, it leads to better alignment of braces.
final PageController controller2 = PageController(initialPage: 0);
final frameworksPage = 1;
controller2.animateToPage(
frameworksPage,
duration: const Duration(milliseconds: 480),
curve: Curves.fastOutSlowIn,
);
This is my personal preference, though.