handleMethodCall method

Future handleMethodCall(
  1. MethodCall call
)

Implementation

Future<dynamic> handleMethodCall(MethodCall call) async {
  switch (call.method) {
    case 'getPlatformVersion':
      final navigator = globalContext['navigator'] as JSObject?;
      final userAgent = navigator?['userAgent'] as JSString?;
      final ua = userAgent?.toDart ?? '';
      return ua.isEmpty ? 'Web' : 'Web ($ua)';
    case 'extractText':
    case 'extractHocr':
      return _extract(
        call.arguments,
        isHocr: call.method == 'extractHocr',
      );
    default:
      throw PlatformException(
        code: 'Unimplemented',
        details: "tesseract_ocr for web doesn't implement '${call.method}'",
      );
  }
}