You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The vscode default debug console does not accept user input. To debug a program requiring user input you will have to set: Preferences > Dart > Run and Debug > Dart: Cli Console to Terminal (or alternatively External Terminal).
By default, the application runs without a terminal. The "Debug Console" you are using is a REPL (Read-Eval-Print Loop) that processes expressions and displays the results.
If you need to read input from stdin, you'll have to configure the extension to run inside a terminal instead. However, this mode may have limited functionality since the debugger will have less access to the process output.
There are two ways to run the application in the terminal: one is by setting the console field in a launch.json file, and the other is by configuring the dart.cliConsole setting in your VS Code User or Workspace Settings, depending on whether you want the change to apply to all projects or just this one.
VS Code Version:
Version: 1.85.1 (user setup)
Commit: https://github-com/microsoft/vscode/commit/0ee08df0cf4527e40edc9aa28f4b5bd38bbff2b2
Date: 2023-12-13T09:49:37.021Z
Electron: 25.9.7
ElectronBuildId: 25551756
Chromium: 114.0.5735.289
Node.js: 18.15.0
V8: 11.4.183.29-electron.0
OS: Windows_NT x64 10.0.19045
OS Version: Windows 10
Steps to Reproduce:
Run this Dart code in VS CODE:
import 'dart:io';
void main() {
var isLoopContinue = true;
var attempts = 0;
while (isLoopContinue == true) {
stdout.writeln("Enter email:");
var email = stdin.readLineSync();
stdout.writeln("Enter password:");
var password = stdin.readLineSync();
if (email == 'admin-gmail.com' && password == "123456") {
print("Login successfully");
isLoopContinue = false;
} else {
attempts++;
if (attempts > 3) {
isLoopContinue = false;
print('Your account has been blocked!');
} else {
print('Invalid credentials. Please try again.');
}
}
}
}
Output:
Enter email:
"HERE IS THE EMAIL INPUT , WE WROTE" //AND THEN ERRORS BELOW
Unknown evaluation response type: null
-0 DartDebugAdapter.evaluateRequest (package:dds/src/dap/adapters/dart.dart:1076:7)
https://github-com/microsoft/vscode/-/1 BaseDebugAdapter.handle (package:dds/src/dap/base_debug_adapter.dart:141:20)
https://github-com/microsoft/vscode/-/2 BaseDebugAdapter.handleIncomingRequest (package:dds/src/dap/base_debug_adapter.dart:447:7)
https://github-com/microsoft/vscode/-/3 BaseDebugAdapter._handleIncomingMessage (package:dds/src/dap/base_debug_adapter.dart:295:7)
https://github-com/microsoft/vscode/-/4 ByteStreamServerChannel._readMessage (package:dds/src/dap/protocol_stream.dart:82:18)
https://github-com/microsoft/vscode/-/5 ByteStreamServerChannel.listen. (package:dds/src/dap/protocol_stream.dart:53:24)
https://github-com/microsoft/vscode/-/6 _RootZone.runUnaryGuarded (dart:async/zone.dart:1594:10)
https://github-com/microsoft/vscode/-/7 _BufferingStreamSubscription._sendData (dart:async/stream_impl.dart:339:11)
https://github-com/microsoft/vscode/-/8 _DelayedData.perform (dart:async/stream_impl.dart:515:14)
https://github-com/microsoft/vscode/-/9 _PendingEvents.handleNext (dart:async/stream_impl.dart:620:11)
https://github-com/microsoft/vscode/-/10 _PendingEvents.schedule. (dart:async/stream_impl.dart:591:7)
https://github-com/microsoft/vscode/pull/11 _microtaskLoop (dart:async/schedule_microtask.dart:40:21)
https://github-com/microsoft/vscode/-/12 _startMicrotaskLoop (dart:async/schedule_microtask.dart:49:5)
https://github-com/microsoft/vscode/-/13 _runPendingImmediateCallback (dart:isolate-patch/isolate_patch.dart:118:13)
https://github-com/microsoft/vscode/-/14 _RawReceivePort._handleMessage (dart:isolate-patch/isolate_patch.dart:185:5)
Code RUNS OK when we run this code via CMD by running this command "dart run filename.dart"
The text was updated successfully, but these errors were encountered: