run method
override
Runs this command.
The return value is wrapped in a Future
if necessary and returned by
CommandRunner.runCommand.
Implementation
@override
void run() async {
final googleVision = await GoogleVision.withJwtFile(
globalResults!['credential-file'],
'https://www.googleapis.com/auth/cloud-vision');
final imageFile = File(argResults!['image-file']).readAsBytesSync();
final requests = AnnotationRequests(requests: [
AnnotationRequest(
jsonImage: JsonImage(byteBuffer: imageFile.buffer),
features: [Feature(type: AnnotationType.safeSearchDetection)],
)
]);
final annotatedResponses = await googleVision.annotate(requests: requests);
print(annotatedResponses.responses);
}