Adjust pause binary
This commit is contained in:
parent
db9964e9e5
commit
c47500e878
1 changed files with 21 additions and 13 deletions
|
@ -2,6 +2,9 @@ import 'dart:io';
|
|||
import 'package:libac_dart/utils/IOTools.dart';
|
||||
|
||||
String getKeyPress() {
|
||||
bool ret = false;
|
||||
String str = "";
|
||||
while (!ret) {
|
||||
// Disable line mode to capture a single key press without requiring Enter
|
||||
stdin.echoMode = false;
|
||||
stdin.lineMode = false;
|
||||
|
@ -14,17 +17,22 @@ String getKeyPress() {
|
|||
stdin.lineMode = true;
|
||||
|
||||
// Return the character representation of the byte
|
||||
return String.fromCharCode(byte);
|
||||
str = String.fromCharCode(byte);
|
||||
|
||||
if (RegExp(r'^[A-Za-z]$').hasMatch(str)) ret = true;
|
||||
}
|
||||
|
||||
int main() {
|
||||
prnt("\rPress Any Key To Continue...");
|
||||
return str;
|
||||
}
|
||||
|
||||
Future<int> main() async {
|
||||
await prnt("\rPress Any Key To Continue...");
|
||||
|
||||
// Listen for a key press
|
||||
String key = getKeyPress();
|
||||
|
||||
// Erase the line by printing a new line
|
||||
prnt("\r\n");
|
||||
await prnt("\r\n");
|
||||
|
||||
// Check if the pressed key is 'Z'
|
||||
if (key.toUpperCase() == 'Z') {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue