메서드 호출 이슈 수정

This commit is contained in:
leedongmyung 2025-02-05 09:05:19 +09:00
parent 340e10ede6
commit 32a8fb5207
3 changed files with 19 additions and 19 deletions

View file

@ -13,7 +13,7 @@ class Application {
writeLog = (error, stack) => logError('$error:\n$stack'); writeLog = (error, stack) => logError('$error:\n$stack');
func(); func();
}, (error, stack) { }, (error, stack) {
writeLog??(error, stack); writeLog?.call(error, stack);
errorListener(error, stack); errorListener(error, stack);
}); });
} }

View file

@ -161,13 +161,13 @@ class ProcessExecutor {
if (Platform.isMacOS || Platform.isWindows) { if (Platform.isMacOS || Platform.isWindows) {
workspace = workspace ?? Directory.systemTemp.path; workspace = workspace ?? Directory.systemTemp.path;
if (printStdout_) { if (printStdout_) {
logHandler ?? ('Execute Shell: $arg', LogType.verbose); logHandler?.call('Execute Shell: $arg', LogType.verbose);
} }
try { try {
processData.process = processData.process =
await Process.start(exe, args, workingDirectory: workspace); await Process.start(exe, args, workingDirectory: workspace);
} on Exception catch (e) { } on Exception catch (e) {
logHandler ?? (e, LogType.error); logHandler?.call(e.toString(), LogType.error);
} }
} else { } else {
logHandler ?? ('This platform not support process executor.'); logHandler ?? ('This platform not support process executor.');
@ -192,7 +192,7 @@ class ProcessExecutor {
var file = File('$workspace/$tempFileName'); var file = File('$workspace/$tempFileName');
processData.file = file; processData.file = file;
if (printStdout_) { if (printStdout_) {
logHandler ?? logHandler?.call
( (
'Execute Shell: ${file.path} \n ${shell.toString()}', 'Execute Shell: ${file.path} \n ${shell.toString()}',
LogType.verbose LogType.verbose
@ -208,14 +208,14 @@ class ProcessExecutor {
processData.process = await Process.start(shellExe, [file.path], processData.process = await Process.start(shellExe, [file.path],
workingDirectory: workspace); workingDirectory: workspace);
} on Exception catch (e) { } on Exception catch (e) {
logHandler ?? (e, LogType.error); logHandler?.call(e.toString(), LogType.error);
} }
} else if (Platform.isWindows) { } else if (Platform.isWindows) {
workspace = workspace ?? Directory.systemTemp.path; workspace = workspace ?? Directory.systemTemp.path;
var file = File('$workspace/$tempFileName'); var file = File('$workspace/$tempFileName');
processData.file = file; processData.file = file;
if (printStdout_) { if (printStdout_) {
logHandler ?? logHandler?.call
( (
'Execute Shell: ${file.path} \n ${shell.toString()}', 'Execute Shell: ${file.path} \n ${shell.toString()}',
LogType.verbose LogType.verbose
@ -232,16 +232,16 @@ class ProcessExecutor {
processData.process = await Process.start( processData.process = await Process.start(
'powershell', ['-NoProfile', '-File', file.absolute.path]); 'powershell', ['-NoProfile', '-File', file.absolute.path]);
} on Exception catch (e) { } on Exception catch (e) {
logHandler ?? (e, LogType.error); logHandler?.call(e.toString(), LogType.error);
} }
} else { } else {
logHandler ?? logHandler?.call
('This platform not support process executor.', LogType.error); ('This platform not support process executor.', LogType.error);
} }
c.complete(processData); c.complete(processData);
await processData.waitForExit(); await processData.waitForExit();
} on Exception catch (e) { } on Exception catch (e) {
logHandler ?? logHandler?.call
('General Exception in ProcessExecutor.start: $e', LogType.error); ('General Exception in ProcessExecutor.start: $e', LogType.error);
} }
return c.future; return c.future;
@ -257,12 +257,12 @@ class ProcessExecutor {
workspace = workspace ?? Directory.systemTemp.path; workspace = workspace ?? Directory.systemTemp.path;
var file = File('$workspace/$tempFileName'); var file = File('$workspace/$tempFileName');
if (printStdout) { if (printStdout) {
logHandler ?? logHandler?.call
( (
'---------------------------------------------------', '---------------------------------------------------',
LogType.verbose LogType.verbose
); );
logHandler ?? logHandler?.call
( (
'Shell Path: ${file.path} \nExecute Shell: ${shell.toString()}', 'Shell Path: ${file.path} \nExecute Shell: ${shell.toString()}',
LogType.verbose LogType.verbose
@ -277,7 +277,7 @@ class ProcessExecutor {
processResult = await Process.run(shellExe, [file.path], processResult = await Process.run(shellExe, [file.path],
workingDirectory: workspace); workingDirectory: workspace);
} on Exception catch (e) { } on Exception catch (e) {
logHandler ?? (e, LogType.error); logHandler?.call(e.toString(), LogType.error);
} finally { } finally {
file.deleteSync(); file.deleteSync();
} }
@ -298,7 +298,7 @@ class ProcessExecutor {
file.deleteSync(); file.deleteSync();
c.complete(processResult); c.complete(processResult);
} else { } else {
logHandler ?? logHandler?.call
('This platform not support process executor.', LogType.error); ('This platform not support process executor.', LogType.error);
c.complete(null); c.complete(null);
} }
@ -308,7 +308,7 @@ class ProcessExecutor {
if (decoder != null) { if (decoder != null) {
stdout = decoder.convert(stdout.codeUnits); stdout = decoder.convert(stdout.codeUnits);
} }
logHandler ?? logHandler?.call
( (
// ignore: prefer_interpolation_to_compose_strings // ignore: prefer_interpolation_to_compose_strings
'[ProcessExecutor] Result: $stdout', '[ProcessExecutor] Result: $stdout',
@ -320,7 +320,7 @@ class ProcessExecutor {
if (decoder != null) { if (decoder != null) {
stderr = decoder.convert(stderr.codeUnits); stderr = decoder.convert(stderr.codeUnits);
} }
logHandler ?? logHandler?.call
( (
// ignore: prefer_interpolation_to_compose_strings // ignore: prefer_interpolation_to_compose_strings
'[ProcessExecutor] Exit Code: ${processResult.exitCode}\nError: $stderr', '[ProcessExecutor] Exit Code: ${processResult.exitCode}\nError: $stderr',

View file

@ -28,11 +28,11 @@ class SocketClient {
} catch (e) { } catch (e) {
print(e); print(e);
} }
resultListener??(connected); resultListener?.call(connected);
// ignore: argument_type_not_assignable_to_error_handler // ignore: argument_type_not_assignable_to_error_handler
}).catchError((AsyncError e) { }).catchError((AsyncError e) {
print('Unable to connect: $e'); print('Unable to connect: $e');
resultListener??(connected); resultListener?.call(connected);
}); });
} }
@ -52,7 +52,7 @@ class SocketClient {
} }
void disconnect() { void disconnect() {
eventDisconnected??(); eventDisconnected?.call();
_socket!.close(); _socket!.close();
_socket = null; _socket = null;
} }
@ -111,6 +111,6 @@ class SocketClient {
void _onDone() { void _onDone() {
print('Disconnected'); print('Disconnected');
eventDisconnected??(); eventDisconnected?.call();
} }
} }