dart-pad
dart-pad copied to clipboard
Potential for confusion between "main" and "solution" editors in embedded layout
Page URL
https://dart.dev/codelabs/dart-cheatsheet.html
Page source
https://github.com/dart-lang/site-www/tree/master/src/codelabs/dart-cheatsheet.md
Describe the problem
The embedded editors don't compile code - they give syntax errors, even for the provided solutions. See screenshot:

Expected fix
Depending on the cause - update a broken dependency, fix bug, provide missing file, etc., such that the editors successfully compile at least the provided solutions.
Additional context
Firefox, several versions, including 94.0 . Happens both on windows and linux, though that should be unsurprising.
Hi @Erhannis! Thanks for opening an issue. When you run code with DartPad it always runs and analyzes the code in the primary tab rather than in the "Solution" tab. You can copy the solution code to the primary "Dart" tab to fix the errors if desired. Does that make sense?
Perhaps we can make this behavior more clear somehow.
Oh, I see - that makes more sense, haha. Adding to my confusion was that I'd also tried to test some unrelated code in the main tab, not realizing it would break hidden tests - so I got compile errors for code that looked fine. (Maybe if there was an untested scratchpad tab you could run, too?)
But yeah, maybe if the Solution tab were formatted differently than the Dart tab, or the Run button etc. were subordinate to the Dart tab, so they'd go away when you switch to the Solution tab?
On Tue, Nov 9, 2021, 11:17 AM Parker Lougheed @.***> wrote:
Hi @Erhannis https://github.com/Erhannis! Thanks for opening an issue. When you run code with DartPad it always runs and analyzes the code in the primary tab rather than in the "Solution" tab. You can copy the solution code to the primary "Dart" tab to fix the errors if desired. Does that make sense?
Perhaps we can make this behavior more clear somehow.
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/dart-lang/site-www/issues/3668#issuecomment-964306061, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAXCNTNDWRJHJEPSZE6LHWDULFCQTANCNFSM5HVVRQQQ . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.
@johnpryan @RedBrogdon maybe we should move/dupe this to the dartpad repo?
Coming back to this issue, the multi-file embedded layout is no longer supported, so this confusion should no longer occur. https://github.com/dart-lang/dart-pad/issues/2808 has some more information.
Thanks again for reporting this and sorry about the original confusion.