image method

  1. @override
Future<ViamImage> image({
  1. MimeType? mimeType,
  2. Map<String, dynamic>? extra,
})
override

Get the next image from the camera.

var nextImage = await myCamera.image();

For more information, see Camera component.

Implementation

@override
Future<ViamImage> image({MimeType? mimeType, Map<String, dynamic>? extra}) async {
  final request = GetImageRequest()
    ..name = name
    ..mimeType = mimeType?.name ?? ''
    ..extra = extra?.toStruct() ?? Struct();
  final response = await client.getImage(request);
  final actualMimeType = MimeType.fromString(response.mimeType);
  return ViamImage(response.image, actualMimeType);
}