I was trying a demo code on the google_ml_kit
plugin and ran into this error-
Error: MissingPluginException(No implementation found for method vision#startImageLabelDetector on channel google_ml_kit)
at Object.throw_ [as throw] (http://localhost:61538/dart_sdk.js:5063:11)
at MethodChannel._invokeMethod (http://localhost:61538/packages/flutter/src/services/restoration.dart.lib.js:1555:21)
at _invokeMethod.next (<anonymous>)
at http://localhost:61538/dart_sdk.js:40192:33
at _RootZone.runUnary (http://localhost:61538/dart_sdk.js:40062:59)
at _FutureListener.thenAwait.handleValue (http://localhost:61538/dart_sdk.js:34983:29)
at handleValueCallback (http://localhost:61538/dart_sdk.js:35551:49)
at Function._propagateToListeners (http://localhost:61538/dart_sdk.js:35589:17)
at _Future.new.[_completeWithValue] (http://localhost:61538/dart_sdk.js:35437:23)
at async._AsyncCallbackEntry.new.callback (http://localhost:61538/dart_sdk.js:35458:35)
at Object._microtaskLoop (http://localhost:61538/dart_sdk.js:40330:13)
at _startMicrotaskLoop (http://localhost:61538/dart_sdk.js:40336:13)
at http://localhost:61538/dart_sdk.js:35811:9
Here's the implementation-
import 'package:google_ml_kit/google_ml_kit.dart';
import 'package:image_picker/image_picker.dart';
Future<List> runStuff() async {
ImagePicker picker = ImagePicker();
XFile? file = await picker.pickImage(source: ImageSource.gallery);
String path = file!.path;
InputImage inputImage = InputImage.fromFilePath(path);
ImageLabeler imageLabeler = GoogleMlKit.vision.imageLabeler();
List out = await imageLabeler.processImage(inputImage);
return out;
}
CodePudding user response:
The exception appeared because the plug-in google_ml_kit
is not supported for web
but only iOS and android