flutter / flutter-intellij

Flutter Plugin for IntelliJ
https://flutter.dev/using-ide
BSD 3-Clause "New" or "Revised" License
1.98k stars 319 forks source link

Android studio reformat code has variants #5080

Closed sm2017 closed 3 years ago

sm2017 commented 3 years ago

Steps to Reproduce

I am using Android studio for my Flutter/Dart project, I use Code->Reformat Code or Ctrl+Alt+L to reformat my code I also checked Before commit -> Reformat code in settings

When I commit my code, it is reformatted by android studio automatically, But after that if I press Ctrl+Alt+L to reformat it again, it reformatted with different rules , If I commit it immediately, auto reformat before commit revert changes and we have nothing to commit

Version info

[√] Flutter (Channel stable, 1.22.4, on Microsoft Windows [Version 10.0.18363.1198], locale en-US)
    • Flutter version 1.22.4 at C:\flutter
    • Framework revision 1aafb3a8b9 (2 weeks ago), 2020-11-13 09:59:28 -0800
    • Engine revision 2c956a31c0
    • Dart version 2.10.4

[√] Android toolchain - develop for Android devices (Android SDK version 29.0.2)
    • Android SDK at C:\Users\PC\AppData\Local\Android\Sdk
    • Platform android-29, build-tools 29.0.2
    • ANDROID_HOME = C:\Users\PC\AppData\Local\Android\Sdk
    • Java binary at: C:\Program Files\Android\Android Studio\jre\bin\java
    • Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b01)
    • All Android licenses accepted.

[!] Android Studio (version 4.1.0)
    • Android Studio at C:\Program Files\Android\Android Studio
    X Flutter plugin not installed; this adds Flutter specific functionality.
    X Dart plugin not installed; this adds Dart specific functionality.
    • Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b01)

[√] Connected device (1 available)
    • Android SDK built for x86 (mobile) • emulator-5554 • android-x86 • Android 10 (API 29) (emulator)

! Doctor found issues in 1 category.
jacob314 commented 3 years ago

It is unfortunate that the before commit command is using the wrong code formatter for dart code. Here is a workaround until we get that code fixed to use Dartfmt.

To use dartfmt to reformat code on save you can enable it under the Flutter settings in IntelliJ. It is confusing that

Screen Shot 2020-11-30 at 8 31 19 AM

@jwren is this a known issue is the dart intelliij plugin?

stevemessick commented 3 years ago

@alexander-doroshko might have some idea here.

jwren commented 3 years ago

We used the to have a different formatter which was customizable (~1 year ago), but now the Dart Plugin uses dartfmt via the DAS, there should be no differences here.

What were the differences seen? I wonder if the version of the dartfmt in DAS isn't matching the dartfmt that we are using in the Flutter Plugin. I assume that that Flutter plugin here is calling the dartfmt binary?

stevemessick commented 3 years ago

@jwren I think the OP is talking about the VCS-driven formatting. Not sure if it uses dartfmt.

Screen Shot 2020-11-30 at 4 04 12 PM

The Flutter plugin uses DAS to do formatting, but only when Format code on save is checked. Otherwise it is all done by the Dart plugin, IIRC.

alexander-doroshko commented 3 years ago

If there are no syntax errors in a file, then the Dart plugin delegates to dartfmt (via an Anaysis Server call) both on Reformat action (Ctrl+Alt+L / Cmd+Alt+L) and on Reformat Before Commit check box. So there should be no differences.

alexander-doroshko commented 3 years ago

@sm2017 But looks like there's a bug with the Reformat Before Commit option. I'll fix that in the Dart plugin. Until fixed, I'd suggest not to use this option.

To make sure I've caught the same bug that you see, could you please look through the idea.log file (Help -> Show Log...) and search for DartStyleAction there. I suspect that there will be an error like

ERROR - rt.ide.actions.DartStyleAction - psiFile.getTextLength()=2709, document.getTextLength()=2697
sm2017 commented 3 years ago

@alexander-doroshko

2020-12-01 17:26:43,286 [28974576]  ERROR - rt.ide.actions.DartStyleAction - Android Studio 4.1.1  Build #AI-201.8743.12.41.6953283 
2020-12-01 17:26:43,286 [28974576]  ERROR - rt.ide.actions.DartStyleAction - JDK: 1.8.0_242-release; VM: OpenJDK 64-Bit Server VM; Vendor: JetBrains s.r.o 
2020-12-01 17:26:43,286 [28974576]  ERROR - rt.ide.actions.DartStyleAction - OS: Windows 10 
2020-12-01 17:26:43,287 [28974577]  ERROR - rt.ide.actions.DartStyleAction - Plugin to blame: Dart version: 201.9245 
2020-12-01 17:26:43,287 [28974577]  ERROR - rt.ide.actions.DartStyleAction - Last Action: EditorPaste 
2020-12-01 17:26:43,287 [28974577]  ERROR - rt.ide.actions.DartStyleAction - Current Command: Reformat Code Before Commit 
2020-12-01 17:26:43,290 [28974580]  ERROR - rt.ide.actions.DartStyleAction - psiFile.getTextLength()=44155, document.getTextLength()=44101 
java.lang.Throwable: psiFile.getTextLength()=44155, document.getTextLength()=44101
    at com.intellij.openapi.diagnostic.Logger.error(Logger.java:146)
    at com.jetbrains.lang.dart.ide.actions.DartStyleAction.reformatRange(DartStyleAction.java:83)
    at com.jetbrains.lang.dart.ide.actions.DartStyleAction.reformatRange(DartStyleAction.java:70)
    at com.jetbrains.lang.dart.ide.formatter.DartPostFormatProcessor.processText(DartPostFormatProcessor.java:34)
    at com.intellij.psi.impl.source.codeStyle.CodeStyleManagerImpl.postProcessText(CodeStyleManagerImpl.java:123)
    at com.intellij.psi.impl.source.codeStyle.CodeStyleManagerImpl.formatRanges(CodeStyleManagerImpl.java:258)
    at com.intellij.psi.impl.source.codeStyle.CodeStyleManagerImpl.reformatText(CodeStyleManagerImpl.java:212)
    at com.intellij.psi.impl.source.codeStyle.CodeStyleManagerImpl.reformatTextWithContext(CodeStyleManagerImpl.java:168)
    at com.intellij.codeInsight.actions.ReformatCodeProcessor.lambda$null$0(ReformatCodeProcessor.java:108)
    at com.intellij.openapi.editor.ex.util.EditorScrollingPositionKeeper.perform(EditorScrollingPositionKeeper.java:110)
    at com.intellij.codeInsight.actions.ReformatCodeProcessor.lambda$prepareTask$1(ReformatCodeProcessor.java:103)
    at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    at com.intellij.openapi.command.WriteCommandAction.lambda$runWriteCommandAction$5(WriteCommandAction.java:353)
    at com.intellij.openapi.command.WriteCommandAction$BuilderImpl$1.run(WriteCommandAction.java:107)
    at com.intellij.openapi.application.RunResult.run(RunResult.java:35)
    at com.intellij.openapi.command.WriteCommandAction.lambda$null$1(WriteCommandAction.java:248)
    at com.intellij.openapi.application.impl.ApplicationImpl.runWriteAction(ApplicationImpl.java:976)
    at com.intellij.openapi.command.WriteCommandAction.lambda$performWriteCommandAction$2(WriteCommandAction.java:247)
    at com.intellij.openapi.command.WriteCommandAction.lambda$doExecuteCommand$4(WriteCommandAction.java:305)
    at com.intellij.openapi.command.impl.CoreCommandProcessor.executeCommand(CoreCommandProcessor.java:220)
    at com.intellij.openapi.command.impl.CoreCommandProcessor.executeCommand(CoreCommandProcessor.java:188)
    at com.intellij.openapi.command.WriteCommandAction.doExecuteCommand(WriteCommandAction.java:307)
    at com.intellij.openapi.command.WriteCommandAction.performWriteCommandAction(WriteCommandAction.java:246)
    at com.intellij.openapi.command.WriteCommandAction.execute(WriteCommandAction.java:227)
    at com.intellij.openapi.command.WriteCommandAction$BuilderImpl.run(WriteCommandAction.java:109)
    at com.intellij.openapi.command.WriteCommandAction.runWriteCommandAction(WriteCommandAction.java:353)
    at com.intellij.codeInsight.actions.AbstractLayoutCodeProcessor$ReformatFilesTask.lambda$performFileProcessing$5(AbstractLayoutCodeProcessor.java:413)
    at com.intellij.openapi.application.TransactionGuardImpl$2.run(TransactionGuardImpl.java:201)
    at com.intellij.openapi.application.impl.ApplicationImpl.runIntendedWriteActionOnCurrentThread(ApplicationImpl.java:831)
    at com.intellij.openapi.application.impl.ApplicationImpl.lambda$invokeAndWait$8(ApplicationImpl.java:480)
    at com.intellij.openapi.application.impl.LaterInvocator$1.run(LaterInvocator.java:124)
    at com.intellij.openapi.application.impl.FlushQueue.doRun(FlushQueue.java:80)
    at com.intellij.openapi.application.impl.FlushQueue.runNextEvent(FlushQueue.java:128)
    at com.intellij.openapi.application.impl.FlushQueue.flushNow(FlushQueue.java:46)
    at com.intellij.openapi.application.impl.FlushQueue$FlushNow.run(FlushQueue.java:184)
    at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:311)
    at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:764)
    at java.awt.EventQueue.access$500(EventQueue.java:98)
    at java.awt.EventQueue$3.run(EventQueue.java:715)
    at java.awt.EventQueue$3.run(EventQueue.java:709)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:74)
    at java.awt.EventQueue.dispatchEvent(EventQueue.java:734)
    at com.intellij.ide.IdeEventQueue.defaultDispatchEvent(IdeEventQueue.java:974)
    at com.intellij.ide.IdeEventQueue._dispatchEvent(IdeEventQueue.java:847)
    at com.intellij.ide.IdeEventQueue.lambda$null$8(IdeEventQueue.java:449)
    at com.intellij.openapi.progress.impl.CoreProgressManager.computePrioritized(CoreProgressManager.java:730)
    at com.intellij.ide.IdeEventQueue.lambda$dispatchEvent$9(IdeEventQueue.java:448)
    at com.intellij.openapi.application.impl.ApplicationImpl.runIntendedWriteActionOnCurrentThread(ApplicationImpl.java:831)
    at com.intellij.ide.IdeEventQueue.dispatchEvent(IdeEventQueue.java:496)
    at com.intellij.ide.IdeEventQueue.pumpEventsForHierarchy(IdeEventQueue.java:1030)
    at com.intellij.openapi.progress.util.ProgressWindow.pumpEventsForHierarchy(ProgressWindow.java:199)
    at com.intellij.openapi.progress.util.ProgressWindow.lambda$startBlocking$3(ProgressWindow.java:189)
    at com.intellij.openapi.application.impl.ApplicationImpl.runUnlockingIntendedWrite(ApplicationImpl.java:857)
    at com.intellij.openapi.progress.util.ProgressWindow.startBlocking(ProgressWindow.java:188)
    at com.intellij.openapi.progress.impl.ProgressRunner.lambda$legacyExec$6(ProgressRunner.java:302)
    at java.util.concurrent.CompletableFuture.uniAccept(CompletableFuture.java:670)
    at java.util.concurrent.CompletableFuture.uniAcceptStage(CompletableFuture.java:683)
    at java.util.concurrent.CompletableFuture.thenAccept(CompletableFuture.java:2010)
    at com.intellij.openapi.progress.impl.ProgressRunner.legacyExec(ProgressRunner.java:300)
    at com.intellij.openapi.progress.impl.ProgressRunner.submit(ProgressRunner.java:248)
    at com.intellij.openapi.progress.impl.ProgressRunner.submitAndGet(ProgressRunner.java:169)
    at com.intellij.openapi.application.impl.ApplicationImpl.runProcessWithProgressSynchronously(ApplicationImpl.java:426)
    at com.intellij.openapi.progress.impl.CoreProgressManager.runProcessWithProgressSynchronously(CoreProgressManager.java:494)
    at com.intellij.openapi.progress.impl.ProgressManagerImpl.runProcessWithProgressSynchronously(ProgressManagerImpl.java:84)
    at com.intellij.openapi.progress.impl.CoreProgressManager.runProcessWithProgressSynchronously(CoreProgressManager.java:237)
    at com.intellij.codeInsight.actions.AbstractLayoutCodeProcessor.runProcessFiles(AbstractLayoutCodeProcessor.java:311)
    at com.intellij.codeInsight.actions.AbstractLayoutCodeProcessor.run(AbstractLayoutCodeProcessor.java:226)
    at com.intellij.openapi.vcs.checkin.ReformatBeforeCheckinHandler.runCheckinHandlers(ReformatBeforeCheckinHandler.kt:42)
    at com.intellij.vcs.commit.AbstractCommitWorkflow$wrapWithCommitMetaHandler$1.run(AbstractCommitWorkflow.kt:220)
    at com.intellij.openapi.vcs.checkin.RearrangeBeforeCheckinHandler$runCheckinHandlers$saveAndContinue$1.invoke(RearrangeBeforeCheckinHandler.kt:37)
    at com.intellij.openapi.vcs.checkin.RearrangeBeforeCheckinHandler$runCheckinHandlers$saveAndContinue$1.invoke(RearrangeBeforeCheckinHandler.kt:22)
    at com.intellij.openapi.vcs.checkin.RearrangeBeforeCheckinHandler.runCheckinHandlers(RearrangeBeforeCheckinHandler.kt:44)
    at com.intellij.vcs.commit.AbstractCommitWorkflow$wrapWithCommitMetaHandler$1.run(AbstractCommitWorkflow.kt:220)
    at com.intellij.openapi.vcs.checkin.OptimizeImportsBeforeCheckinHandler$runCheckinHandlers$saveAndContinue$1.invoke(OptimizeImportsBeforeCheckinHandler.kt:38)
    at com.intellij.openapi.vcs.checkin.OptimizeImportsBeforeCheckinHandler$runCheckinHandlers$saveAndContinue$1.invoke(OptimizeImportsBeforeCheckinHandler.kt:23)
    at com.intellij.openapi.vcs.checkin.OptimizeImportsBeforeCheckinHandler$sam$java_lang_Runnable$0.run(OptimizeImportsBeforeCheckinHandler.kt)
    at com.intellij.codeInsight.actions.AbstractLayoutCodeProcessor.runProcessFiles(AbstractLayoutCodeProcessor.java:319)
    at com.intellij.codeInsight.actions.AbstractLayoutCodeProcessor.run(AbstractLayoutCodeProcessor.java:226)
    at com.intellij.openapi.vcs.checkin.OptimizeImportsBeforeCheckinHandler.runCheckinHandlers(OptimizeImportsBeforeCheckinHandler.kt:42)
    at com.intellij.vcs.commit.AbstractCommitWorkflow$wrapWithCommitMetaHandler$1.run(AbstractCommitWorkflow.kt:220)
    at com.intellij.openapi.vcs.checkin.CodeCleanupCheckinHandler.runCheckinHandlers(CodeCleanupCheckinHandler.kt:33)
    at com.intellij.vcs.commit.AbstractCommitWorkflow$wrapWithCommitMetaHandler$1.run(AbstractCommitWorkflow.kt:220)
    at com.intellij.vcs.commit.AbstractCommitWorkflow$runBeforeCommitChecks$task$1.run(AbstractCommitWorkflow.kt:201)
    at com.intellij.openapi.vcs.impl.PartialChangesUtil.lambda$runUnderChangeList$2(PartialChangesUtil.java:118)
    at com.intellij.openapi.vcs.impl.PartialChangesUtil.computeUnderChangeList(PartialChangesUtil.java:132)
    at com.intellij.openapi.vcs.impl.PartialChangesUtil.runUnderChangeList(PartialChangesUtil.java:117)
    at com.intellij.vcs.commit.SingleChangeListCommitWorkflow.doRunBeforeCommitChecks(SingleChangeListCommitWorkflow.kt:74)
    at com.intellij.vcs.commit.AbstractCommitWorkflow.runBeforeCommitChecks(AbstractCommitWorkflow.kt:209)
    at com.intellij.vcs.commit.AbstractCommitWorkflow.runBeforeCommitChecksWithEvents(AbstractCommitWorkflow.kt:180)
    at com.intellij.vcs.commit.AbstractCommitWorkflow.executeDefault(AbstractCommitWorkflow.kt:171)
    at com.intellij.vcs.commit.AbstractCommitWorkflowHandler.doExecuteDefault(AbstractCommitWorkflowHandler.kt:152)
    at com.intellij.vcs.commit.AbstractCommitWorkflowHandler.access$doExecuteDefault(AbstractCommitWorkflowHandler.kt:46)
    at com.intellij.vcs.commit.AbstractCommitWorkflowHandler$executeDefault$$inlined$run$lambda$1$1.invoke(AbstractCommitWorkflowHandler.kt:121)
    at com.intellij.vcs.commit.AbstractCommitWorkflowHandler$executeDefault$$inlined$run$lambda$1$1.invoke(AbstractCommitWorkflowHandler.kt:46)
    at com.intellij.vcs.commit.AbstractCommitWorkflow.continueExecution$intellij_platform_vcs_impl(AbstractCommitWorkflow.kt:135)
    at com.intellij.vcs.commit.AbstractCommitWorkflowHandler$executeDefault$$inlined$run$lambda$1.invoke(AbstractCommitWorkflowHandler.kt:119)
    at com.intellij.vcs.commit.AbstractCommitWorkflowHandler$executeDefault$$inlined$run$lambda$1.invoke(AbstractCommitWorkflowHandler.kt:46)
    at com.intellij.vcs.commit.AbstractCommitWorkflowHandler$refreshChanges$1.run(AbstractCommitWorkflowHandler.kt:192)
    at com.intellij.openapi.vcs.changes.Waiter.onSuccess(Waiter.java:51)
    at com.intellij.openapi.progress.impl.CoreProgressManager.finishTask(CoreProgressManager.java:540)
    at com.intellij.openapi.progress.impl.CoreProgressManager.lambda$runProcessWithProgressSynchronously$8(CoreProgressManager.java:497)
    at com.intellij.openapi.application.impl.ApplicationImpl.invokeAndWait(ApplicationImpl.java:467)
    at com.intellij.openapi.application.ex.ApplicationUtil.invokeAndWaitSomewhere(ApplicationUtil.java:174)
    at com.intellij.openapi.application.ex.ApplicationUtil.invokeAndWaitSomewhere(ApplicationUtil.java:129)
    at com.intellij.openapi.progress.impl.CoreProgressManager.runProcessWithProgressSynchronously(CoreProgressManager.java:497)
    at com.intellij.openapi.progress.impl.ProgressManagerImpl.runProcessWithProgressSynchronously(ProgressManagerImpl.java:84)
    at com.intellij.openapi.progress.impl.CoreProgressManager.runSynchronously(CoreProgressManager.java:345)
    at com.intellij.openapi.progress.impl.CoreProgressManager.run(CoreProgressManager.java:330)
    at com.intellij.openapi.vcs.changes.CallbackData.lambda$createInteractive$3(CallbackData.java:85)
    at com.intellij.openapi.vcs.changes.UpdateRequestsQueue.invokeAfterUpdate(UpdateRequestsQueue.java:174)
    at com.intellij.openapi.vcs.changes.ChangeListManagerImpl.invokeAfterUpdate(ChangeListManagerImpl.java:374)
    at com.intellij.openapi.vcs.changes.ChangeListManagerImpl.invokeAfterUpdate(ChangeListManagerImpl.java:362)
    at com.intellij.vcs.commit.AbstractCommitWorkflowHandler.refreshChanges(AbstractCommitWorkflowHandler.kt:189)
    at com.intellij.vcs.commit.AbstractCommitWorkflowHandler.executeDefault(AbstractCommitWorkflowHandler.kt:118)
    at com.intellij.vcs.commit.AbstractCommitWorkflowHandler.access$executeDefault(AbstractCommitWorkflowHandler.kt:46)
    at com.intellij.vcs.commit.AbstractCommitWorkflowHandler$executorCalled$1.invoke(AbstractCommitWorkflowHandler.kt:102)
    at com.intellij.vcs.commit.AbstractCommitWorkflowHandler$executorCalled$1.invoke(AbstractCommitWorkflowHandler.kt:46)
    at com.intellij.vcs.commit.AbstractCommitWorkflow$startExecution$1.invoke(AbstractCommitWorkflow.kt:128)
    at com.intellij.vcs.commit.AbstractCommitWorkflow$startExecution$1.invoke(AbstractCommitWorkflow.kt:64)
    at com.intellij.vcs.commit.AbstractCommitWorkflow.continueExecution$intellij_platform_vcs_impl(AbstractCommitWorkflow.kt:135)
    at com.intellij.vcs.commit.AbstractCommitWorkflow.startExecution$intellij_platform_vcs_impl(AbstractCommitWorkflow.kt:126)
    at com.intellij.vcs.commit.AbstractCommitWorkflowHandler.executorCalled(AbstractCommitWorkflowHandler.kt:99)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at com.intellij.util.EventDispatcher.dispatchVoidMethod(EventDispatcher.java:127)
    at com.intellij.util.EventDispatcher.access$000(EventDispatcher.java:21)
    at com.intellij.util.EventDispatcher$1.invoke(EventDispatcher.java:85)
    at com.sun.proxy.$Proxy175.executorCalled(Unknown Source)
    at com.intellij.openapi.vcs.changes.ui.CommitChangeListDialog$CommitAction.actionPerformed(CommitChangeListDialog.java:456)
    at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:2022)
    at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2348)
    at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:402)
    at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:259)
    at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:252)
    at java.awt.AWTEventMulticaster.mouseReleased(AWTEventMulticaster.java:289)
    at java.awt.Component.processMouseEvent(Component.java:6550)
    at javax.swing.JComponent.processMouseEvent(JComponent.java:3325)
    at java.awt.Component.processEvent(Component.java:6315)
    at java.awt.Container.processEvent(Container.java:2239)
    at java.awt.Component.dispatchEventImpl(Component.java:4899)
    at java.awt.Container.dispatchEventImpl(Container.java:2297)
    at java.awt.Component.dispatchEvent(Component.java:4721)
    at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4904)
    at java.awt.LightweightDispatcher.processMouseEvent(Container.java:4535)
    at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4476)
    at java.awt.Container.dispatchEventImpl(Container.java:2283)
    at java.awt.Window.dispatchEventImpl(Window.java:2746)
    at java.awt.Component.dispatchEvent(Component.java:4721)
    at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:766)
    at java.awt.EventQueue.access$500(EventQueue.java:98)
    at java.awt.EventQueue$3.run(EventQueue.java:715)
    at java.awt.EventQueue$3.run(EventQueue.java:709)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:74)
    at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:84)
    at java.awt.EventQueue$4.run(EventQueue.java:739)
    at java.awt.EventQueue$4.run(EventQueue.java:737)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:74)
    at java.awt.EventQueue.dispatchEvent(EventQueue.java:736)
    at com.intellij.ide.IdeEventQueue.defaultDispatchEvent(IdeEventQueue.java:974)
    at com.intellij.ide.IdeEventQueue.dispatchMouseEvent(IdeEventQueue.java:912)
    at com.intellij.ide.IdeEventQueue._dispatchEvent(IdeEventQueue.java:844)
    at com.intellij.ide.IdeEventQueue.lambda$null$8(IdeEventQueue.java:449)
    at com.intellij.openapi.progress.impl.CoreProgressManager.computePrioritized(CoreProgressManager.java:730)
    at com.intellij.ide.IdeEventQueue.lambda$dispatchEvent$9(IdeEventQueue.java:448)
    at com.intellij.openapi.application.impl.ApplicationImpl.runIntendedWriteActionOnCurrentThread(ApplicationImpl.java:831)
    at com.intellij.ide.IdeEventQueue.dispatchEvent(IdeEventQueue.java:502)
    at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:205)
    at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:116)
    at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:109)
    at java.awt.WaitDispatchSupport$2.run(WaitDispatchSupport.java:190)
    at java.awt.WaitDispatchSupport$4.run(WaitDispatchSupport.java:235)
    at java.awt.WaitDispatchSupport$4.run(WaitDispatchSupport.java:233)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.awt.WaitDispatchSupport.enter(WaitDispatchSupport.java:233)
    at java.awt.Dialog.show(Dialog.java:1077)
    at com.intellij.openapi.ui.impl.DialogWrapperPeerImpl$MyDialog.show(DialogWrapperPeerImpl.java:708)
    at com.intellij.openapi.ui.impl.DialogWrapperPeerImpl.show(DialogWrapperPeerImpl.java:437)
    at com.intellij.openapi.ui.DialogWrapper.doShow(DialogWrapper.java:1685)
    at com.intellij.openapi.ui.DialogWrapper.show(DialogWrapper.java:1644)
    at com.intellij.openapi.ui.DialogWrapper.showAndGet(DialogWrapper.java:1658)
    at com.intellij.openapi.vcs.changes.ui.CommitChangeListDialog.activate(CommitChangeListDialog.java:265)
    at com.intellij.vcs.commit.SingleChangeListCommitWorkflowHandler.activate(SingleChangeListCommitWorkflowHandler.kt:62)
    at com.intellij.openapi.vcs.changes.ui.CommitChangeListDialog.commitChanges(CommitChangeListDialog.java:223)
    at com.intellij.openapi.vcs.changes.ui.CommitChangeListDialog.commitChanges(CommitChangeListDialog.java:140)
    at com.intellij.openapi.vcs.actions.AbstractCommonCheckinAction.performCheckIn(AbstractCommonCheckinAction.kt:129)
    at com.intellij.openapi.vcs.actions.AbstractCommonCheckinAction$queueCheckin$1.run(AbstractCommonCheckinAction.kt:84)
    at com.intellij.openapi.vcs.changes.Waiter.onSuccess(Waiter.java:51)
    at com.intellij.openapi.progress.impl.CoreProgressManager.finishTask(CoreProgressManager.java:540)
    at com.intellij.openapi.progress.impl.CoreProgressManager.lambda$runProcessWithProgressSynchronously$8(CoreProgressManager.java:497)
    at com.intellij.openapi.application.impl.ApplicationImpl.invokeAndWait(ApplicationImpl.java:467)
    at com.intellij.openapi.application.ex.ApplicationUtil.invokeAndWaitSomewhere(ApplicationUtil.java:174)
    at com.intellij.openapi.application.ex.ApplicationUtil.invokeAndWaitSomewhere(ApplicationUtil.java:129)
    at com.intellij.openapi.progress.impl.CoreProgressManager.runProcessWithProgressSynchronously(CoreProgressManager.java:497)
    at com.intellij.openapi.progress.impl.ProgressManagerImpl.runProcessWithProgressSynchronously(ProgressManagerImpl.java:84)
    at com.intellij.openapi.progress.impl.CoreProgressManager.runSynchronously(CoreProgressManager.java:345)
    at com.intellij.openapi.progress.impl.CoreProgressManager.run(CoreProgressManager.java:330)
    at com.intellij.openapi.vcs.changes.CallbackData.lambda$createInteractive$3(CallbackData.java:85)
    at com.intellij.openapi.vcs.changes.UpdateRequestsQueue.invokeAfterUpdate(UpdateRequestsQueue.java:174)
    at com.intellij.openapi.vcs.changes.ChangeListManagerImpl.invokeAfterUpdate(ChangeListManagerImpl.java:374)
    at com.intellij.openapi.vcs.changes.ChangeListManagerImpl.invokeAfterUpdate(ChangeListManagerImpl.java:362)
    at com.intellij.openapi.vcs.actions.AbstractCommonCheckinAction.queueCheckin(AbstractCommonCheckinAction.kt:83)
    at com.intellij.openapi.vcs.actions.AbstractCommonCheckinAction.actionPerformed(AbstractCommonCheckinAction.kt:74)
    at com.intellij.openapi.vcs.actions.AbstractVcsAction.actionPerformed(AbstractVcsAction.java:48)
    at com.intellij.openapi.actionSystem.ex.ActionUtil.performActionDumbAware(ActionUtil.java:280)
    at com.intellij.openapi.actionSystem.impl.ActionMenuItem$ActionTransmitter.lambda$actionPerformed$0(ActionMenuItem.java:296)
    at com.intellij.openapi.wm.impl.FocusManagerImpl.runOnOwnContext(FocusManagerImpl.java:281)
    at com.intellij.openapi.wm.impl.IdeFocusManagerImpl.runOnOwnContext(IdeFocusManagerImpl.java:77)
    at com.intellij.openapi.actionSystem.impl.ActionMenuItem$ActionTransmitter.actionPerformed(ActionMenuItem.java:285)
    at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:2022)
    at com.intellij.openapi.actionSystem.impl.ActionMenuItem.lambda$fireActionPerformed$0(ActionMenuItem.java:112)
    at com.intellij.openapi.application.TransactionGuardImpl.performUserActivity(TransactionGuardImpl.java:94)
    at com.intellij.openapi.actionSystem.impl.ActionMenuItem.fireActionPerformed(ActionMenuItem.java:112)
    at com.intellij.ui.plaf.beg.BegMenuItemUI.doClick(BegMenuItemUI.java:517)
    at com.intellij.ui.plaf.beg.BegMenuItemUI.access$300(BegMenuItemUI.java:36)
    at com.intellij.ui.plaf.beg.BegMenuItemUI$MyMenuDragMouseHandler.menuDragMouseReleased(BegMenuItemUI.java:571)
    at javax.swing.JMenuItem.fireMenuDragMouseReleased(JMenuItem.java:586)
    at javax.swing.JMenuItem.processMenuDragMouseEvent(JMenuItem.java:483)
    at javax.swing.JMenuItem.processMouseEvent(JMenuItem.java:429)
    at javax.swing.MenuSelectionManager.processMouseEvent(MenuSelectionManager.java:339)
    at com.intellij.ui.plaf.beg.BegMenuItemUI$MyMouseInputHandler.mouseReleased(BegMenuItemUI.java:541)
    at java.awt.Component.processMouseEvent(Component.java:6550)
    at javax.swing.JComponent.processMouseEvent(JComponent.java:3325)
    at java.awt.Component.processEvent(Component.java:6315)
    at java.awt.Container.processEvent(Container.java:2239)
    at java.awt.Component.dispatchEventImpl(Component.java:4899)
    at java.awt.Container.dispatchEventImpl(Container.java:2297)
    at java.awt.Component.dispatchEvent(Component.java:4721)
    at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4904)
    at java.awt.LightweightDispatcher.processMouseEvent(Container.java:4535)
    at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4476)
    at java.awt.Container.dispatchEventImpl(Container.java:2283)
    at java.awt.Window.dispatchEventImpl(Window.java:2746)
    at java.awt.Component.dispatchEvent(Component.java:4721)
    at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:766)
    at java.awt.EventQueue.access$500(EventQueue.java:98)
    at java.awt.EventQueue$3.run(EventQueue.java:715)
    at java.awt.EventQueue$3.run(EventQueue.java:709)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:74)
    at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:84)
    at java.awt.EventQueue$4.run(EventQueue.java:739)
    at java.awt.EventQueue$4.run(EventQueue.java:737)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:74)
    at java.awt.EventQueue.dispatchEvent(EventQueue.java:736)
    at com.intellij.ide.IdeEventQueue.defaultDispatchEvent(IdeEventQueue.java:974)
    at com.intellij.ide.IdeEventQueue.dispatchMouseEvent(IdeEventQueue.java:912)
    at com.intellij.ide.IdeEventQueue._dispatchEvent(IdeEventQueue.java:844)
    at com.intellij.ide.IdeEventQueue.lambda$null$8(IdeEventQueue.java:449)
    at com.intellij.openapi.progress.impl.CoreProgressManager.computePrioritized(CoreProgressManager.java:741)
    at com.intellij.ide.IdeEventQueue.lambda$dispatchEvent$9(IdeEventQueue.java:448)
    at com.intellij.openapi.application.impl.ApplicationImpl.runIntendedWriteActionOnCurrentThread(ApplicationImpl.java:831)
    at com.intellij.ide.IdeEventQueue.dispatchEvent(IdeEventQueue.java:502)
    at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:205)
    at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:116)
    at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:105)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93)
    at java.awt.EventDispatchThread.run(EventDispatchThread.java:82)
2020-12-01 17:26:43,292 [28974582]  ERROR - rt.ide.actions.DartStyleAction - Android Studio 4.1.1  Build #AI-201.8743.12.41.6953283 
2020-12-01 17:26:43,292 [28974582]  ERROR - rt.ide.actions.DartStyleAction - JDK: 1.8.0_242-release; VM: OpenJDK 64-Bit Server VM; Vendor: JetBrains s.r.o 
2020-12-01 17:26:43,292 [28974582]  ERROR - rt.ide.actions.DartStyleAction - OS: Windows 10 
2020-12-01 17:26:43,292 [28974582]  ERROR - rt.ide.actions.DartStyleAction - Plugin to blame: Dart version: 201.9245 
2020-12-01 17:26:43,292 [28974582]  ERROR - rt.ide.actions.DartStyleAction - Last Action: EditorPaste 
2020-12-01 17:26:43,292 [28974582]  ERROR - rt.ide.actions.DartStyleAction - Current Command: Reformat Code Before Commit 
alexander-doroshko commented 3 years ago

Thanks, I've filed an issue in the Dart plugin's issue tracker and fixed it. The Dart plugin update with the fix will be published in a few days.