Skip to content

m8ty_client_docscan

m8ty_client_docscan solves this by sending documents to the service for code detection and returning matching codes, allowing apps to turn scans into guided digital journeys.

Document scan client can be used to take documents like PDF, JPEG, PNG etc. and to send them to the server for QR code scan. If there are codes available those will be returned to the client.

Check the documentation of the m8ty_client_docscan library to get an idea about the available models and their properties.

import 'package:dio/dio.dart';
import 'package:m8ty_client_docscan/m8ty_client_docscan.dart';
import 'package:m8ty_client_common/m8ty_client_common.dart';
import 'package:built_collection/built_collection.dart';
final docscanClient = M8tyClientDocscan();
docscanClient.setApiKey(m8tyApiKeyAuth, "myApiKey");
Method Description
scanForCodes Scan document for codes like QR codes

Here some examples how the dart client can be used

final docscanClient = M8tyClientDocscan();
docscanClient.setApiKey(m8tyApiKeyAuth, "myApiKey");
final DocumentScanApi documentScanApi = docscanClient.getDocumentScanApi();
// Create MultipartFile documents
final file1 = MultipartFile.fromFile(
'path/to/your/file1.jpg',
filename: 'file1.jpg',
);
final file2 = MultipartFile.fromFile(
'path/to/your/file2.pdf',
filename: 'file2.pdf',
);
// Add the files to a BuiltList
final documents = BuiltList<MultipartFile>([file1, file2]);
// Specify the types (optional)
final types = BuiltList<CodeTypeModel>([
CodeTypeModel.qrcode,
]);
try {
final Response<ScanCodeResponseModel> scanResponse = await documentScanApi.scanForCodes(
documents: documents,
types: types,
filter: "^SPC[\\s\\S]*\$",
);
print('Scanned codes: ${scanResponse.data}');
} on DioException catch (e) {
throw Exception(
'Request failed (status: ${e.response?.statusCode}): ${e.response?.data}',
);
}