Flutter, Dart & Google Vision API - (Error) The argument type 'Painter' can't be assigned to the parameter type 'Image'

49 views Asked by At
 
final googleVision = await GoogleVision.withJwt('path_to_your_jwt_credentials.json');

final image = Painter.fromFilePath(imagePath);
  
  // You can crop the image if necessary to optimize the upload
final cropped = image.copyCrop(70, 30, 640, 480);
  
await cropped.writeAsJpeg('example/cropped.jpg');

final requests = AnnotationRequests(requests: [
    AnnotationRequest(image: cropped, features: [
      Feature(maxResults: 10, type: 'LABEL_DETECTION'), 
    ])
  ]);

Error Message : The argument type 'Painter' can't be assigned to the parameter type 'Image'.dartargument_type_not_assignable Painter cropped Type: Painter

I face this error when trying to implement Google Vision API for label detection in my Flutter application,please help.

solution to solve the error

0

There are 0 answers