startVinScanner static method

Starts the Vehicle Identification Number (VIN) Scanner screen with the specified config.

Returns a VinScannerResult wrapped in ResultWrapper.

Implementation

static Future<ResultWrapper<VinScannerResult>> startVinScanner(
    VinScannerConfiguration config) async {
  try {
    var result =
        await _channel.invokeMethod('startVinScanner', config.toJson());
    return ResultWrapper.fromJson(jsonDecode(result),
        fromJsonT: (data) =>
            VinScannerResult.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());
  }
}