run method Null safety
override
Runs this command.
The return value is wrapped in a Future
if necessary and returned by
CommandRunner.runCommand.
Implementation
@override
void run() async {
await initializeObs();
if (argResults?['embed-picture-format'] == null &&
argResults?['save-to-file-path'] == null) {
throw UsageException(
'At least \'embed-picture-format\' or \'save-to-file-path\' must be specified.',
usage);
}
final takeSourceScreenshot = TakeSourceScreenshot(
sourceName: argResults?['source-name'],
embedPictureFormat: argResults?['embed-picture-format'],
saveToFilePath: argResults?['save-to-file-path'],
fileFormat: argResults?['file-format'],
compressionQuality: int.parse(argResults!['compression-quality']),
width: argResults?['width'],
height: argResults?['height'],
);
final takeSourceScreenshotResponse =
await obs.takeSourceScreenshot(takeSourceScreenshot);
print(takeSourceScreenshotResponse);
obs.close();
}