startTextPatternScanner static method

Starts the Text Data Scanner UI with the provided config.

Returns a ResultWrapper containing a TextPatternScannerUiResult on success, or an error if the operation fails.

Implementation

static Future<ResultWrapper<TextPatternScannerUiResult>>
    startTextPatternScanner(
        TextPatternScannerScreenConfiguration config) async {
  try {
    var result = await ScanbotSdk.channel
        .invokeMethod('startTextPatternScanner', config.toJson());
    return ResultWrapper.fromJson(jsonDecode(result),
        fromJsonT: (data) => TextPatternScannerUiResult.fromJson(
            data as Map<String, dynamic>));
  } on PlatformException catch (e) {
    Logger.root.severe(e);
    return ResultWrapper.error(e.message ?? 'Unknown platform error');
  } on Exception catch (e) {
    return ResultWrapper.error(e.toString());
  }
}